Objective c 加载UITableView时出错
大家好, 我有这些代码,在我的tableview中看不到我的值。上面写着:“程序接收信号sigabrt” 你能帮我一下我的错在哪里吗Objective c 加载UITableView时出错,objective-c,xcode,tableview,Objective C,Xcode,Tableview,大家好, 我有这些代码,在我的tableview中看不到我的值。上面写着:“程序接收信号sigabrt” 你能帮我一下我的错在哪里吗 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return self.nameList.count; } -(UITableViewCell *)tableview:(UITableView *)tableview ce
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.nameList.count;
}
-(UITableViewCell *)tableview:(UITableView *)tableview cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *CellIdentifier=@"Cell";
UITableViewCell *cell=[tableview dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell==nil) {
cell=[[UITableViewCell alloc]initWithFrame:CGRectZero reuseIdentifier:CellIdentifier];
//cell = [[UITableViewCell alloc]
// initWithStyle:UITableViewCellStyleDefault
// reuseIdentifier:CellIdentifier];
}
//Setup the cell
NSString *cellValue=[ListofItems objectAtIndex:indexPath.row];
cell.text=cellValue;
cell.textLabel.text = [self.nameList objectAtIndex: [indexPath row]];
return cell;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
调用tableview numberOfRowsInSection时,哪个是nameList.count的值?尝试将其设置为固定值以进行测试。可能您没有正确设置名称列表
return self.nameList.count;
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 1;
}