简体   繁体   中英

Creating a Custom UITableView in IOS

I am using XCode to develop an App on the iPhone using iOS5 SDK and StoryBoards. I am creating a view for a buddy list in an App that should have the following format:

b1 | b2 | b3
b4 | b5 | b6
b7 | b8 | b9
.... | .... | ....

b corresponds to a buddy cell with an UIImage and 2 labels underneath each other.

So basically I'm trying to make the view in rows and every 3 buddies (columns) a new row would appear for the next entry. After searching around I've found that the solution that is similar to this is to create a vertical table with each cell containing a horizontal table with cells that would contain the buddy information, and doing the proper customization such as transformations and such.

Now I know how to do all that so my question is, is this the best way to go around doing this, or is there a better solution?

Thanks

Short of creating your own control, the way I would do it is:

  • Create a cell that shows up to 3 buddies
  • Create a data source class that returns the correct number of rows (given that there are 3 buddies per row)
  • The data source should initialise your custom cell to the (up to) 3 buddies for that row.

Here is a link with a tutorial on who to create a custom cell for UITableView

http://mobileorchard.com/ios-development-tutorial-series-tableviews/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM