开发者

How to use NSTimer UITableViewCell

In my app UITableVierwCell have an image(gradient cell image) and I want to show another image (gradient cell image) on same position in same cell at didSelectRowAtIndexPath.

I want to show when I select a cell then current cell image (gradient cell image) should be hide and another image (gradient cell image) should be display. I think this can be done by using NSTimer, how 开发者_开发知识库can I do this?


I don't know how you use a NSTimer for this purpose. I will explain some idea in my mind.

Set the tag value for your first image view and place it on the cell. When user select the cell (ie in didSelectRowAtIndexPath)


UITableViewCell *cell = [tableView cellForRowAtIndexPath:[tableView indexPathForSelectedRow]];

        UIView* imageCheckMark = [cell viewWithTag:kCellImageViewTag];
        if (imageCheckMark != nil) 
        {

            [imageCheckMark removeFromSuperview];
            [cell addSubview:secondImageView];
        }
        else
        {
            [cell addSubview:secondImageView];
        }

        [cell setSelected:NO animated:YES];

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜