我有以下代码在UITableView中创建我的单元格。UITableView的第一个单元格为空(UIView中的TableView)
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 5;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *CellIdentifier = @"futureAppointments";
FutureAppointmentsViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (nil == cell) {
[tableView registerNib:[UINib nibWithNibName:@"FutureAppointmentsViewCell" bundle:nil] forCellReuseIdentifier:CellIdentifier];
cell = [[FutureAppointmentsViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier];
}
NSUInteger position = indexPath.row;
cell.appointmentDescription.text = [NSString stringWithFormat:@"%lu. %@. %@", (unsigned long)position, @"Steve", @"10/03/"];
return cell;
}
问题是,tableView的第一个单元格丢失。它应该从0.史蒂夫开始,而是开始1.史蒂夫。也只有4个列表中的元素,而不是5.
当我放置一个断点中的代码,所述第一小区是零。
有谁知道可能发生了什么?
也许你的_header_视图涵盖了它?你有没有试图拉下tableview来查看单元格是否在_something_下,也许呢? – holex