Try using a little trick:
Just set the alpha cells. Put some condition as your own requirements and set alpha.
cell.alpha=0.2;
If this does not work, how do you like it, use the second trick,
Just take an image of the size of a cell having a gray background with a transparent background, just add this image to the image based on the contents of the cell. Like this:
// Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } // Configure the cell... if(indexPath.row==0) { cell.userInteractionEnabled=FALSE; UIImageView *img=[[UIImageView alloc]init]; img.frame=CGRectMake(0, 0, 320, 70); img.image=[UIImage imageNamed:@"DisableImage.png"]; img.backgroundColor=[UIColor clearColor]; [cell.contentView addSubview:img]; [img release]; } else { //Your usual code for cell interaction. } return cell; }
Although I'm not sure about this, it will certainly fulfill your requirement. This will give the illusion in the user's mind that the cell is disabled. Just try using this solution. Hope that solves your problem.
Ajay Sharma May 13 '11 at 10:48 a.m. 2011-05-13 10:48
source share