Max
Max

Reputation: 39

How to creat Static cells with code instead of storyboard in UITabelViewController?

In storyBoard,there are two type cells.One is Dynamic prototype.The other is static Cells.But when I want build a tableViewController without storyboard,How to creat static cells with code? Thanks a lot.

Upvotes: 0

Views: 36

Answers (3)

Vineesh TP
Vineesh TP

Reputation: 7963

Please refer this this code.

It explain Create a static UITableView without Storyboards.

Check the reference link

Upvotes: 1

Max
Max

Reputation: 39

I search some similar questions.If we write a static UITableViewController with code. Maybe we don`t have to use UITableView. Instead we can use UIScrollview and some other UIControls.

Upvotes: 0

MendyK
MendyK

Reputation: 1488

Just create it in your viewdidload

    UITableView *tblView =[UITableView alloc]initWithFrame:self.view.frame style:UITableViewStylePlain]];

and in the cellForRowAtIndexPath method

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"identifier" forIndexPath:indexPath];

If you do this you dont need to configure it in the storyboard.

Upvotes: 0

Related Questions