Designing tableview in iphone
I am making a application which will show data in table view. I am stuck to show record in table view. My table view design is bit difficult for me. Which should be like this.
1) “Title” of records will be show on top of each cell. (For this time any hardcoded TEXT)
2) Just below the record I have to show users profile image. (For this time any hardcoded image)
3) Just beside of user profile image I have to show username. (For this time any hardcoded TEXT)
4) just beside of username I have to show o开发者_运维问答ne button ( button must contain an image). and it will be repeat until whole data shown in table.
I tried it but I am getting problem. Here is my code.
// Adding hardcoded text in table
TableList = [[NSMutableArray alloc] initWithCapacity:6];
[TableList addObject:@"11111 11111"];
[TableList addObject:@"22222 22222"];
[TableList addObject:@"33333"];
[TableList addObject:@"44444"];
[TableList addObject:@"55555"];
[TableList addObject:@"66666"];
Here I am writing code to add images in Cell of table
// Configure the cell...
cell.textLabel.text=[TableList objectAtIndex:[indexPath row]];
UIImage *leftImage=[UIImage imageNamed: @"facebook.png"];
cell.imageView.image= leftImage;
CGRect contentRect = cell.contentView.bounds;
CGFloat boundsX = contentRect.origin.x;
UIImage *fave=[UIImage imageNamed: @"like_symbol.jpg"];
UIButton *customButton = [UIButton buttonWithType:UIButtonTypeCustom];
customButton.frame=CGRectMake(boundsX+170 ,0, 50, 50);
[customButton setImage:fave forState:UIControlStateNormal];
[customButton setImage:fave forState:UIControlStateHighlighted];
[customButton addTarget:self action:@selector(faveIncrement) forControlEvents: UIControlEventTouchUpInside];
[cell.contentView addSubview:customButton];
This is presently output screen.
I need output like this window.
Thanks in advance.
why can't u try Custom UITableViewCell?
More Info
More
check this example from ios reference about advanced tableview cells http://developer.apple.com/library/ios/#samplecode/AdvancedTableViewCells/Introduction/Intro.html
精彩评论