2012-02-11 3 views
0

私のコードはios4で動作します。それがios5で動作するとき、何か問題が起きます。 テーブルビューにはカスタムセルが含まれています。セルには2つのボタンがあり、iosで実行すると、tableviewはセルボタンイベントを取得できます。しかしios5では、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コードは次のとおりです。あなたは、再利用可能なセルを得たかどうかを確認する必要があり

- (IBAction)showMap:(id)sender { 

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

} 

答えて

0

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

あなたのクラス名testCell大文字で始まり、代わりにTestCellを使用してください。