当我再次向下滚动时,tableView中的文本将消失。以编程方式填充的不刷新屏幕TableView
而且我的代码是:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [screenDefBuild.elementsToTableView count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *MyIdentifier = @"MyIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier];
}
ScreenListElements *currentScreenElement = [screenDefBuild.elementsToTableView objectAtIndex:indexPath.row];
cell.textLabel.text = currentScreenElement.objectName;
currentRow++;
return cell;
}
- (void)viewDidLoad
{
[super viewDidLoad];
tableView = [[UITableView alloc] initWithFrame:self.view.bounds];
[tableView setDataSource:self];
[self.view addSubview:tableView];
}
我也想填补我的表视图,以整个屏幕。 (顶部灰色表带)。
试试这个隐藏这段代码// if(cel == nil)....然后现在滚动 – akk 2012-04-23 08:11:10
这两个注释都是非常糟糕的想法,并且破坏了表视图的几个系统优化。 – jackslash 2012-04-23 08:20:07
要解决灰色背带问题,请将您的桌面背景颜色设为白色 – Charan 2012-04-23 08:47:02