1、自定义的cell可以在StoryBoard中的tableview中直接添加。不过还要添加相应的类文件。添加类文件集成UITableViewCell;
2、然后右键拖动,加入cell到nextView的跳转,注意cell要添加Identifier。 segue也要添加Identifier
3、tableview中自定义cell的添加代码如下:
Cell2 *cell = [[[NSBundle mainBundle] loadNibNamed:@"Cell2" owner:self options:nil] objectAtIndex:0];
//对测量懒得设置
return cell;
4、关于实现segue的跳转
在cell被点击的函数中:
[self performSegueWithIdentifier:@"segue的Identifier" sender:[tableView cellForRowAtIndexPath:indexPath]];
注意sender的设置,因为sender将传递到下面“prepareForSugue”函数中的去。
添加跳转处理函数:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([sender isKindOfClass:[Cell2 class]]) {
}
}
}