2010-03-03 2 views

답변

1

은 내가 아는 한이 일을 방법이 없습니다.

필자는 accessoryView에 대한 완벽한 사용자 정의보기를 구현했습니다. 또한 사용자 상호 작용에 따라 변경하고 태블릿 영역을 결정하는 것이 더 쉽습니다. 다른 견해가 필요하지 않다면 버튼 하나로 만 할 수 있다고 생각합니다.

사용자 정의 뷰를 수행하고 그 안에 투명 버튼을 배치했습니다. 내가 셀에 추가이보기 :

CustomDisclosureArea *disArea = [[CustomDisclosureArea alloc] init]; 
[disArea setFrame:CGRectMake(280.0f, 0.0f, 40.0f, 71.0f)]; 
[disArea setTag:DISCLOSURE_ID]; 
[disArea.emptyButton addTarget:self action:@selector(cellButtonHandler:event:) forControlEvents:UIControlEventTouchUpInside]; //this the button inside the view. 
[cell.contentView addSubview:disArea]; 
[disArea switchToState:AreaStateBlank]; //I can set it to different states (blank, checkmark, empty etc. 
[disArea release]; 

이제 우리는 도청 된 세포 알 필요가 있기 때문에 도청하는 accessoryView 조금 특별한 때 호출되는 방법.

- (void) cellButtonHandler:(id)sender event:(id)event { 

    NSSet *touches = [event allTouches]; 
    UITouch *touch = [touches anyObject]; 
    CGPoint currentTouchPosition = [touch locationInView:self.tableView]; 
    NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint: currentTouchPosition]; 
} 

은 그러나 당신은 당신이 didSelectRow 또는 및 accessoryButtonTapped 방법에 얻을 것 같은 인 NSIndexPath로 끝낸다. 당신은 사용자 정의 accessoryView :

+0

감사합니다. 이러한 부품으로 인해 왜 사과가 자신의 음식을 먹지 않고 내가 스타일을 설정할 때 accessoryView를 채우는 지 궁금합니다. ;-) – Sebastian

0

내가 그것을 시도하지 않은하기로 결정한 경우

희망이 도움이되지만 단순히 셀의 accessoryView 속성을 심문하고 체크 표시를 발견하고 서로 대체 할 수있을 이미지 (거의 확실하게 이미지입니다.) 셀 스타일은 체크 표시가있는 이미지 셀이있는 기본 스타일 표 셀일 것입니다.

+0

accessoryView는 명시 적으로 설정하지 않으면 nil입니다. 이 설정되면 accessoryType은 무시됩니다. – Sebastian

+0

Bummer. 나는 그것이 더 단순 할 수 있기를 바랬다. – TechZen