ios7 UITableViewCell selectionStyle won't go back to blue

后端 未结 4 2054
轻奢々
轻奢々 2021-01-30 21:32

Xcode 5.0, iOS 7 and updating an existing app. UITableView selected row is now gray, not blue.

From what I\'ve read they changed the default selection

4条回答
  •  情书的邮戳
    2021-01-30 21:55

    There is only one selectionStyle in iOS7, to change you need to do this manually like below:

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    { 
        ....
        UIView *bgColorView = [[UIView alloc] init];
        bgColorView.backgroundColor = [UIColor colorWithRed:(76.0/255.0) green:(161.0/255.0) blue:(255.0/255.0) alpha:1.0]; // perfect color suggested by @mohamadHafez
        bgColorView.layer.masksToBounds = YES;
        cell.selectedBackgroundView = bgColorView;
        ....
        return cell;
    }
    

提交回复
热议问题