我正在尝试将此应用程序从iPhone转换为iPad ..我已正确设置逻辑但我得到了错误的超额错误。这是代码。
SortingILove *controller = nil;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
controller = [[SortingILove alloc] initWithNibName:@"SortingILove-iPad" bundle:[NSBundle mainBundle]];
}
else
{
myTableView = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame] style:UITableViewStylePlain];
myTableView.delegate = self;
myTableView.dataSource = self;
itemsList = [[NSMutableArray alloc] init];
[itemsList addObject:@" attracted to Places"];
[itemsList addObject:@" in love with Shopping"];
[itemsList addObject:@" alive for Food"];
self.navigationItem.title = @"";
self.view = myTableView;
self.tableView.rowHeight=123;
self.tableView.autoresizesSubviews = YES;
self.tableView.scrollEnabled = YES;
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.backgroundColor = [UIColor blackColor];
UIImage *backgroundImage = [UIImage imageNamed:@"Background.jpg"];
UIImageView *backgroundViews = [[[UIImageView alloc] initWithImage:backgroundImage] autorelease];
[self.tableView setBackgroundView:backgroundViews];
}
[self.navigationController pushViewController:controller animated:YES];
[controller release];
//tableView.backgroundView = backgroundViews;
//[self configureCell:cell atIndexPath:indexPath];
}
答案 0 :(得分:0)
从您的代码中,您只为您的控制器分配初始化iPad,对于iPhone,您不分配它,然后当它出现在[controller release];
行时,它没有任何内容释放!