uitableview中的cellforrow方法里 修改button title

来源:互联网 发布:mysql create event 编辑:程序博客网 时间:2024/06/11 11:11
//判断登陆退出按钮        self.loginBtn = [UIButton buttonWithType:UIButtonTypeCustom];        [self.loginBtn setFrame:cell.frame];        [self.loginBtn addTarget:self action:@selector(loginOrOut:) forControlEvents:UIControlEventTouchUpInside];        if ([GlobalClass shared].user.login) {            [self.loginBtn setBackgroundColor:[UIColor redColor]];            [self.loginBtn setTitle:@"退出" forState:UIControlStateNormal];        }else{            [self.loginBtn setBackgroundColor:[UIColor greenColor]];            [self.loginBtn setTitle:@"登陆" forState:UIControlStateNormal];        }                [cell.contentView addSubview:self.loginBtn]
cell里加了个登陆按钮,登陆后返回这个页面,也刷新tableview了,判断也进入了要改变button title的语句,但是这个title就是改变不了,但是将
[self.loginBtn setTitle:@"退出" forState:UIControlStateNormal];
yu'j语句放到其他地方,可以修改button的title,例如放到viewwillappear里
                                             
0 0