Синий Селектор - iPhone - PullRequest
       17

Синий Селектор - iPhone

0 голосов
/ 21 марта 2012

Как можно выключить синий селектор, когда я вернусь в вид?В тот момент, когда я выбираю его, меня подталкивают к другому виду.Однако, когда я возвращаюсь к исходному виду, он все еще выбран.

enter image description here

Как отключить его, когда я вернусь к исходному виду?

Спасибо.

Ответы [ 3 ]

3 голосов
/ 21 марта 2012

В вашем методе tableView:didSelectRowAtIndexPath: вы должны включить следующее:

[tableView deselectRowAtIndexPath:indexPath animated:YES];
0 голосов
/ 21 марта 2012

Вы также можете попробовать это

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"myCellId";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;

}
// Set up the cell...
cell.textLabel.text = @"foo";
return cell;
}
0 голосов
/ 21 марта 2012

Я "всегда" отменяю выбор строк при исчезновении вида:

-(void)viewDidDisappear:(BOOL)animated {
    int i = 0;
    while (YES) {
        NSIndexPath *path = [NSIndexPath indexPathForRow:i++ inSection:0];
        if ([yourTable cellForRowAtIndexPath:path] == nil) { break; }
        [yourTable deselectRowAtIndexPath:path animated:NO];
    }
}

Не проверял код

...