Iphone 如何解决线程1:信号SIGABRT?这一行[[NSBundle mainBundle]loadNibNamed:“DVDListingView”所有者:自我选项:nil];
可能重复:Iphone 如何解决线程1:信号SIGABRT?这一行[[NSBundle mainBundle]loadNibNamed:“DVDListingView”所有者:自我选项:nil];,iphone,ios,xcode,ios5,ios4,Iphone,Ios,Xcode,Ios5,Ios4,可能重复: 这是我的密码 // Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"LibraryListingCell"; DVDListingViewC
这是我的密码
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"LibraryListingCell";
DVDListingViewCell *cell = (DVDListingViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@"DVDListingView" owner:self options:nil];
cell = [_cell autorelease];
_cell = nil;
}
cell.titleLabel.text = [[dao libraryItemAtIndex:indexPath.row] valueForKey:@"title"];
cell.featureLengthLabel.text = [NSString stringWithFormat:@"%@ minutes",
[[dao libraryItemAtIndex:indexPath.row] valueForKey:@"featureLength"]];
cell.coverImageView.image = [UIImage
imageNamed:[[dao libraryItemAtIndex:indexPath.row] valueForKey:@"coverImage"]];
return cell;
}
如何解决该行的Thread1:Signal SIGABRT问题[[NSBundle mainBundle]loadNibNamed:@“DVDListingView”所有者:自选项:nil] 我建议您尝试一下,同时确保“DVDListingView.xib”是仅用于自定义单元格的NIB
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"LibraryListingCell";
DVDListingViewCell *cell = (DVDListingViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"DVDListingView" owner:self options:nil];
for(id currentObject in topLevelObjects){
if([currentObject isKindOfClass:[DVDListingViewCell class]]){
cell = (DVDListingViewCell *)currentObject;
break;
}
}
}
cell.titleLabel.text = [[dao libraryItemAtIndex:indexPath.row] valueForKey:@"title"];
cell.featureLengthLabel.text = [NSString stringWithFormat:@"%@ minutes",
[[dao libraryItemAtIndex:indexPath.row] valueForKey:@"featureLength"]];
cell.coverImageView.image = [UIImage
imageNamed:[[dao libraryItemAtIndex:indexPath.row] valueForKey:@"coverImage"]];
return cell;
}
线路
[[NSBundle mainBundle] loadNibNamed:@"DVDListingView" owner:self options:nil];
返回一个NSArray。它必须是这样的:
NSArray *xibObjectArray = [[NSBundle mainBundle] loadNibNamed:@"DVDListingView" owner:self options:nil];
//retrieve items from the array
if (xibObjectArray.count == 1) {
cell = [xibObjectArray objectAtIndex:0];
} else {
for (UIView *randomView in xibObjectArray) {
if ([randomView isKindOfClass:[DVDListingViewCell class]]) {
cell = (DVDListingViewCell *)randomView;
}
}
}
好的,谢谢!这有帮助!谢谢!:)现在可以了!谢谢!:)现在可以了!:)