JBL*_*JBL 4 iphone xcode objective-c uitableview ios
当我选择表格行时,没有任何反应.它没有去ContentController,UILabel当我想链接到ContentController时,我找不到我在ContentController.h上声明的内容resultLabel.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
ContentController *detailview = [[ContentController alloc] initWithNibName:@"ContentController" bundle:nil];
detailview.detailString = [NSString stringWithFormat:@"%d",indexPath.row];
[self.navigationController pushViewController:detailview animated:YES];
[detailview release];
}
Run Code Online (Sandbox Code Playgroud)
ContentController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
resultLabel.text = self.detailString;
}
Run Code Online (Sandbox Code Playgroud)
Aak*_*ani 15
这可能是因为您没有将表视图属性设置为委托和数据源:
tableview.delegate=self;
tableview.datasource=self;
Run Code Online (Sandbox Code Playgroud)
或者在xib中设置它们的属性是另一种选择
| 归档时间: |
|
| 查看次数: |
11892 次 |
| 最近记录: |