开发者

customizing a cell in table

I want to have an image on left side of the cell. A text also in same cell. I should have a number of cells in a table.开发者_开发技巧 Where should i store the images ? And how should I place in the table ? Thank You.


cell.imageView.image

is where you would set your image in order for it to appear on the cell.

cell.textLabel.text

is where you put your text that appears in the cell.

As for how would you store the images and text, perhaps a NSArray of images and another one of NSString objects will get the job done. Anyway, for a more in-depth look at how a UITableViewCell works, I suggest taking a look at the documentation.


It would be a lengthy answer. If you will be doing some UITableView customization, this is a really good starting point: link text

Here is a quick snippet I copied from one of my tableView:

    float GREY = 0.8;

CGRect frame = CGRectMake(10, 8, 54, 24);
UIView *rectangle = [[[UIView alloc] initWithFrame:frame] autorelease];
rectangle.backgroundColor = [UIColor colorWithRed:GREY green:GREY blue:GREY alpha:1.0];
[cell.contentView addSubview:rectangle];

This, in the cellForRowAtIndexPath delegate method will build a grey rectangle and place it in the cell at the "frame" coordinates. Build a UIView with a picture instead and add that to the cell, same procedure:)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜