Making Rounded UIView’ on iPhone

I have started developing (mainly) iPhone apps late 2009 and I feel like I have some experience on iOS platform that I can share. I won’t be doing tutorial serias but just some tips and tricks.

Let’s start with some ui tips, there are 2 ways to make rounded views in iPhone. One is using layers which is inefficient way, second is using quartz in drawRect.

Using layers is really simple;


YourView *vw = [[YourView alloc] initWithFrame:CGRectMake(20, 20, 80, 80)];
vw.layer.cornerRadius = 16;
vw.layer.masksToBounds = YES;

simple. The right way is to handle in drawRect;

UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(16.0, 16.0)]; //Add a bezier path
[path addClip]; // and clip

Both two will same view.

About Android

Finally, I had a chance to play with Android SDK and develop something. Something called Istanbul Guide, yes the Android version of my first iPhone App. It’s available both in Android Market and Community Markets for free to download.

qrcode

I’m interested in Android because it’s open, it’s linux, it’s java … etc. If you look at end user point, no doubt that iPhone is the killer.  iOS is its limited, there are boundaries and rules you have to obey. I want freedom. Why? Recently started a new project (still in design phase), which aims to make disabled people’ life easier. Resulted application supposed to modify underling operating system to replace existing user-device interaction like replacing standard keypad … etc. That’s impossible for iOS but not in Android.

I’ll be still working on iOS but I believe innovation happens when it’s open.