Search code examples
iphoneobjective-cioscocoa-touchuikit

highlighted shadow color


How to set the shadowColor of a highlighted Text?

titleLabel.textColor = [UIColor colorWithRed:20.0f/255.0f green:50.0f/255.0f blue:90.0f/255.0f alpha:1.0f];
titleLabel.highlightedTextColor = [UIColor whiteColor];
titleLabel.shadowColor = [UIColor whiteColor];
titleLabel.shadowOffset = CGSizeMake(0, 1.0);

I'm looking for something like: titleLabel.highlightedTextColor.shadowColor = [UIColor blackColor];


Solution

  • This should work:

     if(!yourlabel.highlighed)
     {
         [yourLabel setShadowColor:[UIColor greenColor]];
     }
     else
     {
         [yourLabel setShadowColor:[UIColor blueColor]];
     }
    

    EDIT: A UIlabel has a property called highlighted and is a BOOL. You can check if it's true or not and change the shadow color at the moment you want it done.