Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Buttons - add border

I am making my app ready for iOS7. I did conversion and was working with a user. The button in the app does not look like button. Looks very flat. Is there someway to put border or make it stand like a button?

like image 364
user1509593 Avatar asked Aug 18 '13 04:08

user1509593


People also ask

How to give border to button in iOS?

You can set the border properties on the CALayer by accessing the layer property of the button. The CALayer in the link above allows you to set other properties like corner radius, maskToBounds etc... Make sure you link your target to the QuartCore framework in the Build Phases tab of the target editor.

How do I add a border to UIButton storyboard?

Border Color you can set your UIButton User Defined Run Time Attributes ie borderWidth, cornerRadius, borderColor etc. As shown in the image. Note:- don't use layer. before the attribute name, it will not work.


1 Answers

Try this for adding border, It will work

#import <QuartzCore/QuartzCore.h> 

then in viewDidLoad

_btn.layer.borderWidth=1.0f; _btn.layer.borderColor=[[UIColor blackColor] CGColor]; _btn.layer.cornerRadius = 10; 

also you can fill the color for making appearance somewhat like button, or best way is to use image there

Apart from BorderColor, you can do it by using Runtime attributes too.

enter image description here

like image 105
Mehul Thakkar Avatar answered Sep 27 '22 22:09

Mehul Thakkar