ios UITableViewCell如何点击一个cell出现个图片,不点击图片立马隐藏啊。

解决方案 »

  1.   

    首先你要了解button是很多种状态的
    我写了一个简单的例子,你看下就差不多明白了:
    -(void)doneSomeThing
    {
        UIButton *cellButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [cellButton addTarget:self action:@selector(showPicture)  forControlEvents:UIControlEventTouchUpInside];
        [cellButton addTarget:self action:@selector(dismissPicture)  forControlEvents:UIControlEventTouchUpOutside];
        //把cellButton的大小设置为cell的大小,另外把button添加到cell上面,设置button的alpha为0或者是背景色clearcolor
    }
    - (void)showPicture
    {
        //显示图片
    }
    -(void)dismissPicture
    {
        //隐藏图片
    }