2013-08-12 2 views
-1

사용자 지정 UITableView 셀을 설정했으며 didSelectRowAtIndexPath: 메서드의 속성에 액세스하려고합니다. 그러나, 사용중인 다음 코드에서는 해당 속성 (레이블, 텍스트 필드 등)에 액세스 할 수 없습니다. 나는 또한 cellForRowAtIndexPath:을 참고로 게시했다. 여기에, 나는 didSelectRowAtIndexPath:에서 사용하고있는 코드입니다커스텀 UITableViewCell을 정의하는 방법?

UITableViewCell *cell = [self.setupTable cellForRowAtIndexPath:indexPath]; 

cellForRowAtIndexPath:입니다.

- (UITableViewCell *)tableView:(UITableView *)tableView 
     cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString *CellIdentifier = @"SetupCellID"; 

    SetupCell *cell = (SetupCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 

    if (cell == nil) 
    { 
     NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"SetupCell" owner:self options:nil]; 
     cell = [nib objectAtIndex:0]; 
    } 

    cell.accessoryType = UITableViewCellAccessoryCheckmark; 
    cell.setupFeedName.text = [self.setupFeeds objectAtIndex:indexPath.row]; 

    return cell; 
} 

도움을 주시면 감사하겠습니다.

+0

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } 

당신은 당신의'SetupCell' 클래스의 헤더 파일을 게시 할 수 있습니다. –

답변

3
////Use LIke this 
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ 
    SetupCell *cell=(SetupCell*)[tableView cellForRowAtIndexPath:indexPath]; 
    cell.setupFeedName.text [email protected]"Hari kishan"; 
    } 
+0

다른 질문으로 도와 주시겠습니까? http://stackoverflow.com/questions/18186854/selecting-cells-and-moving-them-to-a-separate-array –

+0

답변을 게시했습니다. >>>보기 >> –

0

이 링크를 확인하십시오. below. 지금까지 발견 된 가장 쉬운 방법입니다.

cellForRowAtIndexPath 메서드에서 아래 코드를 바꾸면됩니다. 이 코드

mycustomCell *cell = (mycustomCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
if (cell == nil) { 
    cell = [[[mycustomCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; 
} 
+0

저를 도울 수 있습니까? 다른 질문? http://stackoverflow.com/questions/18186854/selecting-cells-and-moving-them-to-a-separate-array –

관련 문제