Storyboard warning: prototype table cells must have reuse identifiers

前端 未结 11 1023
礼貌的吻别
礼貌的吻别 2020-12-07 19:36

I am getting this warning from storyboard - prototype table cells must have reuse identifiers.

I have renamed the identifier in the attributes inspector but it does

11条回答
  •  有刺的猬
    2020-12-07 20:00

    This for setting reuse identifier by programmatically

    -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath (NSIndexPath*)indexPath 
    {
        static NSString *cellIdentifier = @"wot";
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];
    
        if (!cell)
            cell = [[UITableViewCell alloc] initWithStyle: someStyle reuseIdentifier: cellIdentifier];
    
        return cell;
    }
    

提交回复
热议问题