UILabel shadow from custom cell selected color

前端 未结 4 1970
后悔当初
后悔当初 2020-12-29 12:48

I\'m loading a custom nib file to customize the cells of a UITableView. The custom nib has a UILabel that is referenced from the main view by tag. I would like to know if it

4条回答
  •  误落风尘
    2020-12-29 13:29

    I prefer to make the shadow color change inside the TableCell code to not pollute the delegate. You can override this method to handle it:

    - (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animate
    {
        UIColor * newShadow = highlighted ? [UIColor clearColor] : [UIColor whiteColor];
    
        nameLabel.shadowColor = newShadow;
    
        [super setHighlighted:highlighted animated:animate];
    }
    

提交回复
热议问题