大佬教程收集整理的这篇文章主要介绍了iphone – 添加TableView子视图崩溃应用程序,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
这是我的按钮代码:
-(IBACtion)buttonPressed:(id)sender { LevelChoice *level = [[LevelChoice alloc] initWithNibName:nil bundle:nil]; [self.view addSubview:level.view]; [level release]; }
以下是我的UITableViewController子类的代码片段:
LevelChoice.h
码:
@interface LevelChoice : UITableViewController { NSArray *choices; }
LevelChoice.m
码:
-(void)viewDidLoad { choices = [[NSArray alloc] initWithObjects:@"Level 1",@"Level 2",@"Level 3",nil]; [super viewDidLoad]; }
码:
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 3; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowATindexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reusEIDentifier:CellIdentifier] autorelease]; } cell.text = [choices objectATindex:indexPath.row]; return cell; }
有谁知道我错过了什么?
以上是大佬教程为你收集整理的iphone – 添加TableView子视图崩溃应用程序全部内容,希望文章能够帮你解决iphone – 添加TableView子视图崩溃应用程序所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。