Setting static cells in uitableview programmatically

后端 未结 5 1468
温柔的废话
温柔的废话 2021-01-02 17:11

I am programmatically creating a tableview in objective c. How can I make the cells static programmatically?

Thanks

5条回答
  •  甜味超标
    2021-01-02 17:29

    Making cells static programmatically doesn't really make sense. Static cells are basically only for Interface Builder and requires the entire TableView to be static. They allow you to drag UILables, UITextFields, UIImageViews, etc. right into cells and have it show up just how it looks in Xcode when the app is run.

    However, your cells can be "static" programmatically by not using an outside data source and hardcoding everything, which is usually going to be kind of messy and generally a poor idea.

    I suggest making a new UITableViewController with a .xib and customizing it from there if you want "static" cells. Otherwise, just hardcode all your values and it's basically the same thing, but is probably poor design if it can be avoided.

提交回复
热议问题