Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6074811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:25:26+00:00 2026-05-23T10:25:26+00:00

I have a rounded UIImageView. When I add a shadow to it, I lose

  • 0

I have a rounded UIImageView. When I add a shadow to it, I lose the rounded corner. How can I have a shadow with a rounded corner?

//Avatar
        CGRect rect;
        rect = CGRectMake(13, 10, 48, 48);
        avatarImageView = [[TCImageView alloc] initWithURL:[NSURL URLWithString:nil] placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
        avatarImageView.frame = rect;
        avatarImageView.caching = YES;

        //Round the corners
        CALayer * layer = [avatarImageView layer];
        [layer setMasksToBounds:YES];
        [layer setCornerRadius:9.0];

        //Add a shadow
        avatarImageView.layer.shadowColor = [UIColor grayColor].CGColor;
        avatarImageView.layer.shadowOffset = CGSizeMake(0, 1);
        avatarImageView.layer.shadowOpacity = 1;
        avatarImageView.layer.shadowRadius = 9.0;
        avatarImageView.clipsToBounds = NO;

        [self.contentView addSubview: avatarImageView];
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:25:27+00:00Added an answer on May 23, 2026 at 10:25 am

    The feature, which makes your image appear with rounded corner is the one which hides the shadow: [layer setMasksToBounds: YES]. The thing you can do, put your ImageView within a UIView subview which acts as a container providing the shadow.

    So code could look like this (I just typed it down, did not compile it though)

    //Avatar
    CGRect rect;
    rect = CGRectMake(13, 10, 48, 48);
    avatarImageView = [[TCImageView alloc] initWithURL:[NSURL URLWithString:nil]   placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
    avatarImageView.frame = rect;
    avatarImageView.caching = YES; 
    
    //Round the corners
    CALayer * layer = [avatarImageView layer];
    [layer setMasksToBounds:YES];
    [layer setCornerRadius:9.0];
    
    //Add a shadow by wrapping the avatar into a container
    UIView * container = [[UIView alloc] initWithFrame: rect];
    avatarImageView.frame = CGRectMake(0,0,rect.size.width, rect.size.height);
    
    // setup shadow layer and corner
    container.layer.shadowColor = [UIColor grayColor].CGColor;
    container.layer.shadowOffset = CGSizeMake(0, 1);
    container.layer.shadowOpacity = 1;
    container.layer.shadowRadius = 9.0;
    container.layer.cornerRadius = 9.0;
    container.clipsToBounds = NO;
    
    // combine the views
    [container addSubview: avatarImageView];
    [self.contentView addSubview: container];
    [container release];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working with large numbers that I can't have rounded off. Using Lua's standard
How can I have just the top corners rounded for a WPF rectangle? I
I know it is possible to have rounded corners on objects like a UIImageView
I use QuartzCore to add rounded corners to my UIImageView 's within the cells
I wanted to have an UIImageView appear with rounded corners, and found the following
I need to style a table to have rounded corners. I'm just looking at
We are creating an XBAP application that we need to have rounded corners in
I have created some rounded navigation tabs using CSS and am having trouble when
I have a border element with rounded corners containing a 3x3 grid. The corners
I have been trying very hard to achieve rounded corners with IE6+jquery ui tabs.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.