UITableViewCell里加了个UISwitch

来源:互联网 发布:用doc运行java编译乱码 编辑:程序博客网 时间:2024/04/28 21:08

http://www.cocoachina.com/ask/questions/show/98163?tab=newest

我在UITableViewCell里加了个UISwitch,点击这个UISwitch,出现响应的点击事件怎么做;

[cell.switch addTarget:self action:@selector(switchAction:)forControlEvents:UIControlEventValueChanged];

-(void)switchAction:(id)sender{

    //

   XXXCell *cell =(XXXCell*)[[sender superviewsuperview];

   NSIndexPath* index=[self.tableview indexPathForCell:cell];

  //------

}

0 0