StoryBoard选中tabelview中的一行利用拖线push跳转到另外一个界面不成功的解决方案
文章目录
1,检查数据源创建cell的方法
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *indet = @"person";
//默认回去缓存池中找cell,没有的话去storeboard中招identifier相等的cell
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:indet];
//不能用下面的方法
// if (cell == nil) {
// cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:indet];
// }
NSDictionary *dict = self.contacts[indexPath.row];
cell.textLabel.text = dict[@"name"];
cell.detailTextLabel.text = dict[@"phone"];
return cell;
}
2,在storeboard中设置cell的Identifier值,要和数据源中定义的值一样
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论