Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Rounded Corners on a UIView

SteapsSteaps Posts: 469Tutorial Authors, Registered Users
edited July 2010 in Tutorial Requests
I would love to know how to round the corners on a UIView.

Tutorial or code snippit would be great.

Thanks :).
Post edited by Steaps on
<div align="center"><b><a href="http://itunes.com/apps/quickevade" target="_blank">Evade - iPhone Game</a><br />
<a href="http://itunes.com/apps/itasks" target="_blank">iTasks - Task Manager/Todo List</a><br />
<a href="http://steaps.techaos.com/" targe
·

Replies

  • ftmftm Posts: 523Registered Users
    edited May 2009
    The easiest way I have found is to make the background color of the UIView transparent, then put a disabled Rounded Rect button with no text covering the entire UIView (this makes the rounded corners), then put whatever else you want on top of that.
    <a href="http://fasterthanmonkeys.com" target="_blank">app_showcase.jpg</a><br />
    <br />
    Website: <a href="http://fasterthanmonkeys.com" target="_blank">http://fasterthanmonkeys.com</a><br />
    <br />
    <a href="
    ·
  • sijo006sijo006 Posts: 23Registered Users
    edited July 2010
    ftm wrote: »
    The easiest way I have found is to make the background color of the UIView transparent, then put a disabled Rounded Rect button with no text covering the entire UIView (this makes the rounded corners), then put whatever else you want on top of that.
    yes..thats an easy trick....thank u...
    ·
  • BattleDuelBattleDuel Posts: 10Registered Users
    edited July 2010
    There's an even easier way ("self" in this case is an UIView):
    // create round corners
    [self.layer setCornerRadius:8.0f];
    [self.layer setMasksToBounds:YES];
    

    call this in the init method of your view and you're done.
    <b>Website:</b> <a href="http://www.battleduel.com/" target="_blank">http://www.battleduel.com/</a><br />
    <b>Twitter:</b> <a href="http://twitter.com/battleduel" target="_blank">http://twitter.com/battleduel</a>;
    ·
Sign In or Register to comment.