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 8250901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:03:42+00:00 2026-06-08T00:03:42+00:00

I need a UIButton with backgound image,rounded corner on top and shadow.Here is my

  • 0

I need a UIButton with backgound image,rounded corner on top and shadow.Here is my code

I tried many post from stack overflow,but none worked for me.

I was able to add UIButton having background image with rounded corners and shadow using following.

CALayer *imageLayer = [imageButton layer];
imageLayer.frame =  CGRectMake(110, 190, 100, 100);
imageLayer.cornerRadius = 10.0; 
imageLayer.shadowColor = [UIColor grayColor].CGColor;
imageLayer.shadowOpacity = 1.0;
imageLayer.shadowRadius = 1;
imageLayer.shadowOffset = CGSizeMake(03.0f, 08.0f);
imageLayer.masksToBounds = YES;


CALayer *sublayer = [CALayer layer];
sublayer.backgroundColor = [UIColor blueColor].CGColor;
sublayer.shadowOffset = CGSizeMake(5, 8);
sublayer.shadowRadius = 2.0;
sublayer.shadowColor = [UIColor grayColor].CGColor;
sublayer.shadowOpacity = 0.8;
sublayer.frame = imageLayer.frame;
sublayer.borderColor = [UIColor blackColor].CGColor;
sublayer.borderWidth = 0.0;
sublayer.cornerRadius = 10.0;

[imageButton.layer.superlayer insertSublayer:sublayer atIndex:0];

Now How Can I make top corners rounded.

  • 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-06-08T00:03:44+00:00Added an answer on June 8, 2026 at 12:03 am

    You can have a look at the ColoredRoundedButton open source implementation. It uses the cornerRadius property of the UIButton’s CALayer to get rounded corners.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on an iOS app, and I need to prevent a UIButton from
I need to call: @property (nonatomic, retain) IBOutletCollection(UIButton) NSArray *buttons; from viewcontroller x but
Need to store the tag from a clicked button: - (IBAction)buttonClicked:(id)sender { UIButton *button
I need a UIButton with image & text . Image should be in the
I need to set title for Custom UIBarButtonItem. I've the following code: UIButton* backToRecent
I need to send a string as parameter in UIButton selector. Taking global string
Need some regular expressions help. So far I have my code working to allow
I need to create a UIButton programatically and then put it on a created
I need to change the alpha value for the UIButton can any one suggest
I need to display an email address on the left side of a UIButton

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.