How do I load uitableview into one of the sharded control buckets?
I am developing an iphone application in which I want to apply a table view when clicking on one of the segments of a segmented control.
I did this as I am just doing with uitableviewcontroller as parent class. But how can I do it with uiviewcontroller as parent class. is there any way to do
tableview.hidden = NO; other.hidden = YES;
in segmented management
or any other way to show the list.
+2
source to share
1 answer
Even as a UIViewController, you can add a table view and be a tableViewDelegate. You will have to programmatically create the tableView, set up a frame for it, and add it to the viewController.subview.
Then, after adding the segment control, you can hide or show the table view depending on the segment state.
theTableView = [[UITableView alloc] initWithFrame:frame style:UITableViewStyleGrouped];
theTableView.backgroundColor = [UIColor clearColor];
theTableView.autoresizingMask = (UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight);
theTableView.delegate = self;
theTableView.dataSource = self;
[self.view addSubview:theTableView]
;
+2
source to share