开发者

Can UITableView be used to create a grid?

IS it possible to create the list of contacts or friends (Facebook for example),3 in a row ? For example like 3 friends image with their name below in the first row and next three in the next row and goes on till the contacts are over. which can be selected 开发者_开发知识库for further process. Is there a API for this ??

Just like the home screen of iPhone or better example would be the application "Tap to chat"


Well there are a couple ways that you could do this, so I'm just going to throw out what makes sense to me. As far as I know there is no API specifically built for this.

How I would do this is to programmatically create my grid made of UIButtons. You would be storing these in an array of course, and I don't know if you have any ideas on if you would limit how many on a screen or per "page". Afterwards you could go through your array and change the background images of the buttons, effectively creating an Image Button(I don't know for sure, but something like this might already exist). It shouldn't be terribly hard, you just have to define for yourself what it is exactly that you want, how it interacts with its surrounds, etc.

Another option would be to create a very simple view that contains your image and your label, and the programatically create instances of this, though I don't think that adding button functionality would be as easy. It is still very possible I just don't know how to do it off the top of my head.


Use a UITableView with a custom cell with whatever you want in it, load those 4 images and names of the persons depending on the row number . To get the custom cell, create an IBOutlet to the cell and use this method.

[[NSBundle mainBundle] loadNibNamed:@"customCellView" owner:self options:nil];

To make a cell, make a new Nib/Xib file which is blank, make files owner the class with the cells, drag a UITableviewcell object out and put whatever objects you want on top of that view, set background as clear color and when you load the nib, enter all info into those images and labels. GL

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜