Reputation: 1289
hii every one
how can i design the following screen, inside UIViewController class (not table view controller) programatically
thanx in advance
Upvotes: 1
Views: 3243
Reputation: 11145
Please have a look at the tutorial -
UITableView grouped table tutorial
Upvotes: 1
Reputation: 1883
Add following code in .h
@interface yourViewController:UIViewController<UITableViewDelegate,UITableViewDataSource>
{
UITableView *yourTable;
}
and add following code in .m inside viewDidLoad
yourTable = [[UITableView alloc]initWithFrame:CGRectMake(0, 50, 300, 300)];
yourTable.dataSource = self;
yourTable.style=UITableViewStyleGrouped;
[self.view addSubview:yourTable];
and also you will have to set datasource and delegates as per your requirement
Upvotes: 0
Reputation: 3754
Try this Code;
myTableView = [[UITableView alloc] initWithFrame:CGRectMake(0,0,320,480)style:UITableViewStyleGrouped];
myTableView.delegate = self;
myTableView.dataSource = self;
[self.view addSubview:myTableView];
Upvotes: 2
Reputation: 26390
Add a UITableView
inside the view of the View controller and set the data source and delegate
of the table view as the view controller. Make the UITableView
a grouped one..
This tutorial will help you
If you want to a new table view initialize it using
- (id)initWithFrame:(CGRect)frame style:(UITableViewStyle)style;
You can do the following:
UITableView *myTable = [[UITableView alloc] initWithFrame:CGRectMake(0,0,320,480) style:UITableViewStyleGrouped];
Upvotes: 3