2012-02-11 4 views
0

ios4에서 코드를 실행해도 문제가 없습니다. iOS5에서 실행되면 문제가 발생합니다. 테이블 뷰에는 사용자 정의 셀이 포함됩니다. 셀은 2 개의 버튼을 포함하고 있는데, ios에서 실행될 때, tableview는 셀 버튼 이벤트를 가질 수 있습니다. 하지만 ios5에서 tableview 셀 단추 이벤트를 얻을 수 없습니다. 무엇이 잘못되었는지 나는 잘 모르겠습니다. 도와주세요. 덕분에 ! 코드 예제는 다음과 같습니다 의 tableview 코드는 다음과 같습니다IOS5 문제의 tableviewcell, tabviewcell 발신자 이벤트를 가져올 수 없습니다.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 
    if ([self.selectType selectedSegmentIndex] == 0) { 
     testCell *cell = (testCell *)[tableView  dequeueReusableCellWithIdentifier:@"testCell"]; 
     cell.dataSource = [self.testCellData objectAtIndex:indexPath.row]; 
     return cell; 
    } 
} 

tableviewcell 코드는 다음과 같습니다

testCell *cell = (testCell *)[tableView dequeueReusableCellWithIdentifier:@"testCell"]; 
if (!cell) { 
    cell = [testCell alloc] init... 
} 

귀하의 클래스 명 testCell : 당신은 재사용 가능한 셀을 가지고있는 경우

- (IBAction)showMap:(id)sender { 

    NSLog(@"showMap"); 
    [[NSNotificationCenter defaultCenter] postNotificationName:@"testCellSelected" object:[NSArray arrayWithObjects:[NSNumber numberWithInt:0], [dataSource valueForKey:@"ll"],nil]];  
} 

} 

답변

0

당신은 확인해야 대문자로 시작해야하며 대신 TestCell을 사용하십시오.

관련 문제