iphone how to disable scrolling of tableview cells
i have 4 rows in my table view
as a home screen. First I want to disable scrolling o开发者_Go百科f cells up
and down
. Secondly, I want to put a logo image to the 4th cell.
Can anyone suggest me right way to do so?
Thanks in advance.
to disable scrolling use
tableView.scrollEnabled = NO;
and in cellForRowAtIndexPath method
use this code snippet after cell has been created
if(indexPath.row == 3) {
cell.imageView.image = [UIImage imageNamed:@"nameOfImage.png"];
}
self.tableView.scrollEnabled = NO
For adding image to your cells, go to the cellForRowAtIndexPath
and create UIImage
and add them them as subviews to your cells.
if (indexPath.row ==3)
// allocate your image 1
[cell.contentView addSubview: image1];
// and so on.
Edit :
Just try this.
UIImageView *sampleImage = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"sample.jpg"]] autorelease];
sample.frame = CGRectMake(20, 10, 75, 75);
[cell addSubview:sampleImage];
精彩评论