UITableView に CustomCells を設定しており、didSelectRowAtIndexPath を呼び出そうとしています。カスタム セルのヘッダーは次のとおりです。
#import <UIKit/UIKit.h>
@interface CustomCell : UITableViewCell {
IBOutlet UILabel *bizNameLabel;
IBOutlet UILabel *addressLabel;
IBOutlet UILabel *mileageLabel;
IBOutlet UIImageView *bizImage;
}
@property (nonatomic, retain) UILabel *bizNameLabel;
@property (nonatomic, retain) UILabel *addressLabel;
@property (nonatomic, retain) UILabel *mileageLabel;
@property (nonatomic, retain) UIImageView *bizImage;
@end
かなりシンプルで簡単です。セルのcellForRowAtIndexPathメソッドにもセルに追加しているdetailDisclosureButtonがあり、メソッドaccessoryButtonTappedForRowWithIndexPath:
が呼び出されていますが、didSelectRowAtIndexPathはそうではありません。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"CustomCell";
CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CustomCellView"
owner:self options:nil];
#ifdef __IPHONE_2_1
cell = (CustomCell *)[nib objectAtIndex:0];
#else
cell = (CustomCell *)[nib objectAtIndex:1];
#endif
}
// Configure the cell.
NSDictionary *dict = [rows objectAtIndex: indexPath.row];
/*
CODE TO POPULATE INFORMATION IN CUSTOM CELLS HERE
*/
#ifdef __IPHONE_3_0
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
#endif
return cell;
}
すべてのメソッドとブレークポイント内に NSLog を配置しました。私が呼び出そうとしているメソッドはそうではありませんが、私の CustomCell クラス内では、次のメソッドはそうです。CustomCell の使用中に didSelectRowAtIndexPath を呼び出す方法はありますか?
- (void)setSelected:(BOOL)selected animated:(BOOL)animated