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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:06:41+00:00 2026-05-28T15:06:41+00:00

For UIButton i was using first UIButtonTypeCustom now i want to change it to

  • 0

For UIButton i was using first UIButtonTypeCustom now i want to change it to RoundedRect but when i change UIButtonTypeCustom to UIButtonTypeRoundedRect it shows RoundedRect in white instead of color specified for it and plus it shows edges of rect buttonframe in back of roundedrect button. So i want to know how to fix this thing.

UIButton *myButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];

[myButton addTarget:self action:@selector(dismissView:) forControlEvents:UIControlEventTouchUpInside];

myButton.frame = CGRectMake(0, 0, 60, 30);

[myButton setTitle:@"Done" forState:UIControlStateNormal];

myButton.backgroundColor = [UIColor colorWithHue:1.0/12 saturation:2.0/3 brightness:4.0/10 alpha:1.0];

UIBarButtonItem *button = [[UIBarButtonItem alloc] initWithCustomView:myButton];

[[self navigationItem] setLeftBarButtonItem:button animated:YES];

Thanks for help.

  • 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-28T15:06:43+00:00Added an answer on May 28, 2026 at 3:06 pm

    Mmm… I afraid it is not possible to change the backgroundColor of your UIButton if it is UIButtonTypeRoundedRect.

    My suggestion is to create a UIButtonTypeCustom and change its layer to mimic a UIButtonTypeRoundedRect.

    Try this code:

    #import <QuartzCore/QuartzCore.h>
    
    [myButton.layer setMasksToBounds:YES];
    [myButton.layer setCornerRadius:10.0f];
    [myButton.layer setBackgroundColor:[UIColor whiteColor].CGColor;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using an UINavigationController: in my first view there is an UIButton which pushes
I've subclassed the UIButton class and now a custom view will be drawn using
I want to play two sounds, but the last one only after the first
I UIButton using + buttonWithType: What I need to figure out is how to
When using drawRect for a custom UIButton subclass, it never seems to get called
I have a UIButton, and I'd like to update its title, but I'd rather
I created a UIButton programmatically and I want to create an action to handle
I have a UIButton that is created inside of each table cell. I want
Im extending the UIButton Class to be able to set the font and color
I'm using Core Plot 0.9 in my first iPad project. I need to create

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.