简体   繁体   中英

Rounded buttons in XCode 4.6

I have been looking for an answer to this question on google and other places, but have not found a helpful answer as of yet.

I am making an app on Xcode 4.6 using storyboards.

When drag and drop a Rounded Rectangle Button, it is fine, but when I change the background, it becomes rectangular with no rounded edges. i just wanted to change the colour of button and not anything more, but keep it rounded as the original buttons. Could someone tell me a simple method to achieve this or give me a detailed instruction as I am using storyboard and I am rather poor with XCode programming, so the little the programming, the better.

Thanks in advance.

You probably should check the UIAppearance Protocol documentation for iOS .

Meanwhile, you can use...

    [[UIButton appearance] setTintColor:[UIColor redColor]];

of course, with your color.

UPDATE:

I have used an alternative method as I do not understand the suggestions which were given to me as I am not as knowledgeable about XCode programming and didn't want to take the coding route.

This may be useful for others, but what i done was that I in Photoshop, I filled the background black, used the rounded rectangle tool on the whole background and then filled the rounded rectangle with the button colour. This somewhat gave a rounded shape, but is still not as good as the original rounded buttons provided in XCode.

If anyone has any other solutions, I am free to try them out and will comment and update what I will do.

I will select the best answer by looking at which one was the simplest although I have not used that method

I suggest you to use GradientButtons

http://code.google.com/p/iphonegradientbuttons/downloads/list

1) Define regular buttons in your storyboard files.

2) Change their class to GradientButton.

3) If you want a different color, initialize them in the corresponding view.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM