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 selectionStyle
to gray. But "Blue" is still an option in IB and UITableViewCellSelectionStyleBlue
still exists. Checking out the new HIG, it doesn't look like they removed the blue and the "Settings" app still using blue cell selection.
I've tried setting the value in IB and in code, but no luck. Any ideas on what I need to do to get the blue selection style back?
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; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With