Note that there are some explanatory texts on larger screens.

plurals
  1. POAdd Round Corner to UIImageVIew and Display Shadow effect
    primarykey
    data
    text
    <p>I have the same problem as the link here: <a href="https://stackoverflow.com/questions/3316424/cant-add-a-corner-radius-and-a-shadow">Can&#39;t add a corner radius and a shadow</a></p> <p>if I put maskToBounds = YES, I get round corners, but no shadow If I put maskToBounds = NO, I get shadow, but no round corners. </p> <p>Then I followed the instruction in that link above , setting maskToBounds = NO, " but rather set the corner radius and set the bezier path of the shadow with a rounded rect. Keep the radius of the two the same ". But then, I don't get round corners, nor did I get any shadow! (i.e. Square Image without Shadow) Could you please help me out of this? I don't know what did I do wrong. Thanks in advance. </p> <pre><code>self.userImageView.backgroundColor = [UIColor redColor]; self.userImageView.clipsToBounds = NO; self.userImageView.contentMode = UIViewContentModeCenter; self.userImageView.layer.masksToBounds = NO; self.userImageView.layer.borderWidth = 1; self.userImageView.layer.borderColor = [[UIColor grayColor] CGColor]; self.userImageView.layer.shadowOpacity = 1; self.userImageView.layer.shadowColor = [[UIColor blackColor] CGColor]; self.userImageView.layer.shadowRadius = 8.0f; self.userImageView.layer.shadowOffset = CGSizeMake(-3, 0); self.userImageView.layer.shouldRasterize = YES; self.userImageView.layer.shadowPath = [[UIBezierPath bezierPathWithRoundedRect:[self.userImageView bounds] cornerRadius:10.0f] CGPath]; [self addSubview:self.userImageView]; </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.
 

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