<分区>
<分区>
我在 Storyboard中制作了我的原型(prototype)单元格并设置了它的标识符,但是当我调用
cell=[tableView dequeueReusableCellWithIdentifier:@"ident" forIndexPath:indexPath];
在我的 cellForRowAtIndexPath
方法中出现异常:
unable to dequeue a cell with identifier ident - must register a nib or a class for the identifier or connect a prototype cell in a storyboard
现在,我知道,如果我在 Storyboard 中声明一个原型(prototype)单元,我不需要显式注册它。 那么……为什么会出现这个异常?
最佳答案
尝试做这些..
删除这些..
NSString *identificatore=@"voce";
然后做这些..
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
{
static NSString *yourcellidentifier=@"cella_opzioni_menu";//here write the cell identifier you gave in storyboard..
cell=[tableView dequeueReusableCellWithIdentifier:yourcellidentifier];
if(cell == nil)
{
........
}
.
.
.
}
希望对你有帮助
关于ios - objective-c : dequeueReusableCellWithIdentifier:forIndexPath: returns exception,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32566106/