cell.accessoryType в Симуляторе 3.0? - PullRequest
       1

cell.accessoryType в Симуляторе 3.0?

0 голосов
/ 06 августа 2009

Я пытаюсь установить флажок в приложении при просмотре таблицы. он работает в симуляторе 2.2.1, но не в симуляторе 3.0.

1 Ответ

0 голосов
/ 21 апреля 2010

Следующий код позволяет добавить флажок в ячейку UITableView.
Успешно протестирован на симуляторе iPhone под SDK 2.2.1 и 3.0.


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
// Create or reuse cell
NSString *CellIdentifier = [NSString stringWithFormat:@"%d:%d", [indexPath indexAtPosition:0], [indexPath indexAtPosition:1]];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
// Modify cell
switch ([indexPath indexAtPosition:0]) {
    case(0): // First section
        switch ([indexPath indexAtPosition:1]) {
        case(0): // First cell
        cell.textLabel.text = @"Text";
        cell.accessoryType = UITableViewCellAccessoryCheckmark;
        break;
    }
}
return cell;
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...