mardi 17 mars 2015

cellForRowAtIndexPath not called but numberofRowsInSection called for UITableView added as subview to UIView


Vote count:

0




I have created custom alert view where i want to add the UITableView as subview.I haven't created UITableView through (IB) but created programmatically,Also I have implement protocol UITableViewDelegate and UITableViewDataSource in UIView.But the method cellForRowAtIndexPath not called. I think the problem is here i have to create UITableView through IB make it visible.is it possible not to create through IB but using below code and implement the delegate methods.


Here is the code



privacy_tableview = [[UITableView alloc] initWithFrame:CGRectMake(10.0, 0.0, alert_width-40.0, 0.0)]; [privacy_tableview sizeToFit];
privacy_tableview.frame = CGRectMake(10.0, 0.0, alert_width-40.0, privacy_tableview.frame.size.height);

//Add scrollview which contain uitableview
MsgScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(10.0, alert_height, alert_width-20.0, (privacy_tableview.frame.size.height>max_msg_height)?max_msg_height:privacy_tableview.frame.size.height)];

[privacy_tableview setDataSource:self];
[privacy_tableview setDelegate:self];

[privacy_tableview reloadData];


asked 6 secs ago







cellForRowAtIndexPath not called but numberofRowsInSection called for UITableView added as subview to UIView

Aucun commentaire:

Enregistrer un commentaire