【发布时间】:2013-12-08 05:41:40
【问题描述】:
嗨,我正在使用 storyborad 在 IOS 中创建 UI。eveything 很好,但它没有导航到下一个视图控制器。我正在使用如下代码
[self performSegueWithIdentifier:@"identifier" sender:self]; and
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if([segue.identifier isEqualToString:@"identifier"]){
ViewController *destVC =(ViewController *) [segue destinationViewController];
}
我的 Tableview 代表
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"InfoCell";
HMSForumInfoCell *cell = (InfoCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"InfoCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
cell.selectionStyle=UITableViewCellSelectionStyleNone;
NSLog(@"Cell created");
}
NSDictionary *detailsDic = [_filteredListOfForums objectAtIndex:indexPath.row];
[cell.headLinesLabel setText:[detailsDic objectForKey:kTopic]];
// Adding underlined Colored text using NSMutableAttributedString
NSMutableAttributedString *commentString = [[NSMutableAttributedString alloc] initWithString:[detailsDic objectForKey:kCreatedby]];
UIColor* textColor = [UIColor colorWithRed:255.0f/255.0f green:198.0f/255.0f blue:0.0f/255.0f alpha:1.0f];
[commentString setAttributes:@{NSForegroundColorAttributeName:textColor,NSUnderlineStyleAttributeName:[NSNumber numberWithInteger:NSUnderlineStyleSingle]} range:NSMakeRange(0,[commentString length])];
[cell.nameButton setAttributedTitle:commentString forState:UIControlStateNormal];
// [cell.nameButton addTarget:self action:@selector(replyButtonAction:) forControlEvents:UIControlEventTouchUpInside];
[cell.nameButton addTarget:self action:@selector(namebuttonPressed:) forControlEvents:UIControlEventTouchUpInside];
[cell.replyButton addTarget:self action:@selector(replyButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
return cell;
}
- (void)replyButtonPressed:(id)sender {
[self performSegueWithIdentifier:@"id1" sender:self];
}
- (void)namebuttonPressed:(id)sender {
[self performSegueWithIdentifier:@"id2" sender:self];
}
请纠正我哪里做错了。 P.S:我已经将 View Controller 与故事板中的 segueIdentifier 正确连接,并将 VC 的类名更改为我的类。
【问题讨论】:
-
记录了错误?例外?
-
那么这里有什么问题呢?请添加有关您的问题的更多信息,因为现在几乎无法回答。
-
您使用的是模态转场吗?如果没有,您肯定在故事板中有导航控制器
-
检查您的转场标识符名称,它是否与转场名称匹配?也许您正在使用故事板视图控制器标识符名称进行 segue
-
我也检查了我的 segue 名称。Control 即将进入下一个视图控制器 viewdidload 和 tableview 委托问题是它没有显示下一个视图控制器@suhit
标签: ios objective-c uinavigationcontroller storyboard push