cell单选

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

OpenShopsTypeCell *cell = [tableView cellForRowAtIndexPath:indexPath];
NSString *title = _typeTitles[indexPath.row];
if (_delegate && [_delegate respondsToSelector:@selector(selectedShopType:)]) {
    [_delegate selectedShopType:title];
}
cell.button.selected=YES;

}
-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath{
OpenShopsTypeCell *cell = [tableView cellForRowAtIndexPath:indexPath];
cell.button.selected=NO;

}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 概述在iOS开发中UITableView可以说是使用最广泛的控件,我们平时使用的软件中到处都可以看到它的影子,类似...
    liudhkk阅读 9,101评论 3 38
  • 前言 最近忙完项目比较闲,想写一篇博客来分享一些自学iOS的心得体会,希望对迷茫的你有所帮助。博主非科班出身,一些...
    GitHubPorter阅读 1,474评论 9 5
  • //设置行高 (CGFloat)tableView:(UITableView *)tableView height...
    俊月阅读 1,315评论 0 1
  • 走过了“山的时代”,来到了“时代的山”。尽管它依旧高大雄伟,依旧壮观,依旧沉默…但却依旧不可避免的被留下硕大的烙印...
    邹戈阅读 300评论 0 1
  • 火车之于生长在大山大河中的我来说,本应该是陌生的,奈何有了“远方情结”,这些年也与它有着诸多或长或短的相遇。 这一...
    小沃姑娘阅读 389评论 0 1