Я пытался понять это, но я просто не могу ...
по какой-то причине каждый раз, когда мой UITableView достигает определенной длины из-за количества строк и разделов, ячейки, кажется, случайным образом копируют себя в разные ячейки в конце таблицы, и я не желаю или не программирую это ... У кого-то еще есть эта проблема или знает, как это решается? Любая помощь приветствуется! Танки.
Редактировать:
Свойство "row" - это счетчик, который считается до 13, а затем сбрасывается до 0 и снова подсчитывается, и я всегда хочу, чтобы строка "newUpdate" отображалась в соответствующей строке, но в то же время я не хочу остальные ячейки должны быть пустыми, я хочу, чтобы они сохранили свое старое содержимое до тех пор, пока они не будут перезаписаны, потому что счетчик снова начинается с 0.
#import "ServerUpdateViewController.h"
@implementation ServerUpdateViewController
@synthesize newUpdate;
@synthesize row;
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 15;
}
- (NSString *)tableView: (UITableView *)table titleForHeaderInSection:(NSInteger) section {
return @"All Updates to Server";
}
// Customize the appearance of table view cells.
- (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];
}
if (indexPath.row == self.row) {
cell.textLabel.text = self.newUpdate;
}
// Set up the cell...
return cell;
}
- (void)dealloc {
[super dealloc];
}
@ конец