Reputation: 3111
I have a UITableView inside a UIViewController like so:
.h
@interface OutageListViewController : UIViewController<UITableViewDelegate,UITableViewDataSource> {
IBOutlet UITableView *outageTable;
.m
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"Selected");
}
I have customized table cell:
//EDIT I have fire UILabel side by side on my customized view, as well as a background spreading the entire area. But after resizing/removing the background image and label I putted on the customized cell, "didSelectRowAtIndexPath" is still not being called. //END EDIT
@interface AbstractSummaryListViewCell : UITableViewCell {...}
and
@interface FiveColumnSummaryCell : AbstractSummaryListViewCell {...}
This UIView is inside another UIView:
@interface CustomTabBarController : UIViewController {
OutageListViewController *outageListViewController;
And my AppDelegate add this to the window:
[window addSubview:[customTabBarController view]];
Now I'm trying to determine which cell get clicked and didSelectRowAtIndexPath doesn't get called, I have dataSource and delegate connect from the UITableView to File's Owner, in fact the data populates correctly as my "cellForRowAtIndexPath" specifies, any ideas how can I fix this?
Thanks!
Upvotes: 3
Views: 9263
Reputation: 3111
I solved it: forgot to check User Interaction Enabled in my customized cell xib. What a fool!
Upvotes: 4
Reputation: 18428
Are the following properties of UITableView all YES
?
Edit
:
I think Paul is right. The delegate property has some problem. You can check the delegate property of tableView inside -(void)viewDidLoad. As you said, they should be connected to FileOwner in xib. So the following codes won't obtain nil.
- (void)viewDidLoad {
[super viewDidLoad];
// They should not be nil.
NSLog(@"delegate:%@ dataSource:%@", self.tableView.delegate, self.tableView.dataSource);
}
Upvotes: 3
Reputation: 3845
It's possible that the view controller has not been connected to the delegate
property of the outageTable
anywhere.
Upvotes: 2
Reputation: 25927
You can make a quick test... Remove the "big" label and see if the didSelectRowAtIndexPath is called.
Upvotes: 0