2012-03-21 2 views
0

보기로 다시 이동할 때 파란색 선택기가 꺼지게하려면 어떻게해야합니까? 지금 내가 그것을 선택할 때, 나는 다른 견해로 밀린다. 그러나 원래보기로 돌아 가면 여전히 선택됩니다. 내가 원래보기로 다시 갈 때블루 셀렉터 - iPhone

enter image description here

어떻게 그것을 해제 할 수 있습니까?

감사합니다.

[tableView deselectRowAtIndexPath:indexPath animated:YES]; 

답변

0

시도해 볼 수도 있습니다.

- (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

감사합니다. rakeshNS - 큰 도움. –

+0

그럼 선택자가 전혀 없습니다. 나쁜 습관이 있습니다. – basvk

3

당신은 다음을 포함한다

-(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]; 
    } 
} 

코드

을 확인하지 않았
+0

감사합니다. 정말로 큰 도움이됩니다. 또한 스토리 보드를 사용하여 화살표를 표시 할 수 있음을 알았습니다. –

+0

이것은 애플이 귀하의 앱을 거부하는 것입니다. 선택을 취소해야하는 UI 가이드 라인의 일부입니다. –

0

나는 "항상"행을 선택 해제 뷰가 사라질 때 : 당신의 tableView:didSelectRowAtIndexPath: 방법에서

+0

감사합니다. 큰 도움. –