views:

4793

answers:

2

Basically i have a login View which has a subview and it has a UIActivityView and Label saying "Signing In....", this subview has a corners which are not "round", how i can make them to look like "rounded"

Is there anyway to do it using IB?

+36  A: 

Try this

view.layer.cornerRadius = 5;
Ed Marty
There is no such cornerRadius property.
itsaboutcode
You have to #import <QuartzCore/QuartzCore.h> first.
digdog
Note that property only exists in iPhone 3.0, not earlier versions.
Kendall Helmstetter Gelner
I just have to say that this was one of the most immediately satisfying answers I've ever seen on SO. Checking here first just saved me an hour of fighting with an image editor and would have made my view more brittle to color / sizing changes. Thanks!
Justin Searls
Related note: anyone interested in more visual goodies (i.e. shadow) to easily apply to a UIView should check out the CALayer class reference. Most of it is as easy as setting one or two property values, like the above answer: http://developer.apple.com/mac/library/documentation/GraphicsImaging/Reference/CALayer_class/Introduction/Introduction.html
Justin Searls
You are the man! So easy! :)
Chintan Patel
I have tried this on a view that was loaded from a nib file, and it didn't work. http://pastie.org/964695
Ben Collins
Didn't work as in nothing happened or didn't compile?
Ed Marty
see this linkhttp://cocoabugs.blogspot.com/2010/08/add-rounded-corners-and-border-to.html
jeeva
@Ben Collins (or anyone else who has this problem), make sure your view has "clip subviews" set. You can check this in interface builder.
zem
Thank you very much!
Sasho
+5  A: 

Another method is here.

http://www.iphonedevsdk.com/forum/tutorial-requests/18807-rounded-corners-uiview.html#post85415

Sijo
one more http://cocoabugs.blogspot.com/2010/08/add-rounded-corners-and-border-to.html
jeeva