I have a subclass of UITableViewCell. It adds a few extra elements to the base view (via xib) ,
but It can not take effect.
cell.selectionStyle = UITableViewCellSelectionStyleBlue;
The above two kinds of Settings are unable to take effect.
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.selectionStyle = UITableViewCellSelectionStyleGray;
Two other background style can take effect. I am very confused.
This is not an iOS mistake. There's no more blue selection style since iOS 7. The only selection styles provided are UITableViewCellSelectionStyleNone and UITableViewCellSelectionStyleGray.
From UITabieViewCell Class Reference :
UITableViewCellSelectionStyleBlue
The cell has a default background color when selected.
In iOS 7, the selection color is no longer blue. Use UITableViewCellSelectionStyleDefault instead.
Available in iOS 2.0 and later.
If you want, you can set your own custom selection background by setting the selectedBackgroundView
property of UITableViewCell.
If you have noticed, even in the non custom uitableviewcell, if you set the selection colour as blue or grey , it shows the same colour effect. I guess it is the mistake present in IOS and it is not your fault. I have not tried creating a custom rgb colour for tableview cell. You can try doing that
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.