无法从XIB iPhone加载传感器
当我试图通过无法从XIB iPhone加载传感器,iphone,ios,uitableview,Iphone,Ios,Uitableview,当我试图通过XIB加载传感器时,应用程序崩溃,并给出以下异常 *由于未捕获异常而终止应用程序NSUnknownKeyException,原因:[setValue:forUndefinedKey::此类不符合密钥传送带的密钥值编码 有人能帮我解决这个问题吗。试试这个: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { // Conf
XIB
加载传感器时,应用程序崩溃,并给出以下异常
*由于未捕获异常而终止应用程序NSUnknownKeyException
,原因:[setValue:forUndefinedKey::
此类不符合密钥传送带的密钥值编码
有人能帮我解决这个问题吗。试试这个:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
// Configure the cell.
static NSString *CustomCellIdentifier = @"customCell";
customCell *cell = (customCell *)[tableView dequeueReusableCellWithIdentifier: CustomCellIdentifier];
if (cell == nil)
{
NSArray *nib;
nib = [[NSBundle mainBundle] loadNibNamed:@"customCell" owner:self options:nil];
for (id oneObject in nib)
if ([oneObject isKindOfClass:[customCellr class]])
cell = (customCell *)oneObject;
cell.title.text = @"Hello";
}
return cell;
}
希望它能帮助你
谢谢。您需要转到本课程的
XIB
,检查是否有链接警告,如下图所示
删除这些类型的链接,然后运行应用程序。尝试为单元格创建对象,并按照下面的代码执行操作
(UITableViewCell *)tableView:(UITableView *)tableview_ cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString
*simpleTableIdentifier = @"SimpleTableCell";
ISOPriceCell *cell = (ISOPriceCell *)[tableview_ dequeueReusableCellWithIdentifier:simpleTableIdentifier]; if (cell
== nil) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"ISOPriceCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
cell.priceTextFiled.keyboardType = UIKeyboardTypeNumberPad;
cell.priceTextFiled.delegate = self;
cell.selectionStyle = UITableViewCellSelectionStyleNone;}}
您正在尝试添加自定义单元格吗?请在此处发布您的代码,以便我们可以在需要时更正您嘿,伙计们,谢谢您的好评。因为有一个iboutlet设置为错误视图。现在,它起作用了。ThxYupp,若有异常,那个么应用程序不会被你们的代码压碎。很高兴能帮助你。。享受编码……)