角が丸い長方形の非常に単純な UIView サブクラスを作成して使用しようとしています。次のように新しいクラスを作成しました。
RoundedRect.h
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
@interface RoundedRect : UIView
@end
RoundedRect.m
#import "RoundedRect.h"
@implementation RoundedRect
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
[[self layer] setCornerRadius:10.0f];
[[self layer] setMasksToBounds:YES];
}
return self;
}
@end
ストーリーボードで iOS 5.1 を使用しており、IB インスペクタ ウィンドウでカスタム クラス プロパティを「RoundedRect」に設定しましたが、アプリを実行すると、四角形の角はまだ直角です。明らかな何かを見逃しましたか?
ありがとうジョナサン