メモ
丸角の View を 使いたい時は、「layer.cornerRadius 」を使うと簡単。
QuartsCore を使うので、Build Phase – Link Binary With Libraries にそれを追加。
(iOS 5 で実験)
サンプルコード
#import “ViewController.h”
#import <QuartzCore/QuartzCore.h>
@interfaceViewController ()
@end
@implementation ViewController
– (void)viewDidLoad
{
[superviewDidLoad];
self.view.backgroundColor = [UIColorwhiteColor];
UIView *roundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0 , 100, 100)];
roundView.center = self.view.center;
roundView.backgroundColor = [UIColorblueColor];
roundView.layer.cornerRadius = 20; // 丸角
[self.view addSubview:roundView];
}
@end