What's the difference between static cells and dynamic prototypes?

前端 未结 1 1819
遥遥无期
遥遥无期 2021-02-03 18:34

I want to know the difference between making the cells in my UITableView \"Static Cells\" or choosing \"Dynamic Prototypes\".

If I want to make a UITa

相关标签:
1条回答
  • 2021-02-03 19:16

    Static cells are basically a "what you see is what you get" in Interface Builder. What you put into the UITableView is what you'll see when you run the app.

    Dynamic prototypes, instead, allow you to lay out cells that you can re-use by calling:

    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:CELL_ID_SET_IN_IB];
    

    With this, you determine the number of cells using the delegate methods in the UITableViewController. You can have multiple prototype cells and determine which to load depending on index path.

    You can use segues with both.

    I would recommend prototypes for your app since it seems like, from your question, the number of cells you have will change.

    0 讨论(0)
提交回复
热议问题