jeudi 25 juin 2015

after adding uitableview to uiview didselectrowatindexpath not called ios

I have created a custom tableview displayCustomUnitTableView and a custom UIView displayView and adding displayCustomUnitTableView to displayView. But i am not able to select any row in the tableView i.e., didSelectRowAtIndexPath is not called.

I am using the following code:

displayCustomUnitTableView = [[UITableView alloc]initWithFrame:CGRectMake(52.0, 110.0, 180.0, 110.0) style:UITableViewStylePlain];
displayCustomUnitTableView.delegate = self;
displayCustomUnitTableView.dataSource = self;
displayCustomUnitTableView.tag = 2;
displayCustomUnitTableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
displayCustomUnitTableView.separatorColor = [UIColor blackColor];
displayCustomUnitTableView.rowHeight = 30.f;
[displayCustomUnitTableView setBackgroundColor:[ContentViewController colorFromHexString:@"#BCC9D1"]];
[displayCustomUnitTableView setBackgroundColor:[UIColor groupTableViewBackgroundColor]];
[displayCustomUnitTableView setAllowsSelection:YES];
[displayView addSubview:displayCustomUnitTableView];

Thanks in advance.

See more ..

Aucun commentaire:

Enregistrer un commentaire