Note that there are some explanatory texts on larger screens.

plurals
  1. POmultiple shadowOffset on UIViewController
    primarykey
    data
    text
    <p>I've looked on the web but my results mainly consist of "how to do a shadowOffset." I need to apply "Shadow,Border, and CornerRadius" to multiple objects in my views. I just wanted to see if theres a more effienct way? Or if theres a way to keep it more organized. heres some of my code. Keep in mind I have multiple views like this, so the amount of space this code takes gets pretty annoying.</p> <pre><code>topView.layer.cornerRadius = 3; topView.layer.masksToBounds = YES; topView.layer.borderColor= [UIColor lightGrayColor].CGColor; topView.layer.borderWidth = 0.5f; bottomView.layer.cornerRadius = 3; bottomView.layer.masksToBounds = YES; bottomView.layer.borderColor= [UIColor lightGrayColor].CGColor; bottomView.layer.borderWidth = 0.5f; eventName.layer.masksToBounds = NO; eventName.layer.shadowColor = [UIColor blackColor].CGColor; eventName.layer.shadowOpacity = 0.5; eventName.layer.shadowRadius = 2; //(right,down) also (-right,-down) eventName.layer.shadowOffset = CGSizeMake(0.0f, 0.8f); addressLabel.layer.masksToBounds = NO; addressLabel.layer.shadowColor = [UIColor blackColor].CGColor; addressLabel.layer.shadowOpacity = 0.5; addressLabel.layer.shadowRadius = 2; //(right,down) also (-right,-down) addressLabel.layer.shadowOffset = CGSizeMake(0.0f, 0.8f); dateLabel.layer.masksToBounds = NO; dateLabel.layer.shadowColor = [UIColor blackColor].CGColor; dateLabel.layer.shadowOpacity = 0.5; dateLabel.layer.shadowRadius = 2; //(right,down) also (-right,-down) dateLabel.layer.shadowOffset = CGSizeMake(0.0f, 0.8f); typeLabel.layer.masksToBounds = NO; typeLabel.layer.shadowColor = [UIColor blackColor].CGColor; typeLabel.layer.shadowOpacity = 0.5; typeLabel.layer.shadowRadius = 2; //(right,down) also (-right,-down) typeLabel.layer.shadowOffset = CGSizeMake(0.0f, 0.8f); eventCaption.layer.masksToBounds = NO; eventCaption.layer.shadowColor = [UIColor blackColor].CGColor; eventCaption.layer.shadowOpacity = 0.5; eventCaption.layer.shadowRadius = 2; //(right,down) also (-right,-down) eventCaption.layer.shadowOffset = CGSizeMake(0.0f, 0.8f); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload