iPhone
[objc] xib와 커스텀 UIView 만들기
tenn
2014. 2. 20. 19:17
1. UIView를 계승한 클래스 만듦.
2. xib만듦
3. UIView에.. 추가
+ (id)customView
{
CustomView *customView = [[[NSBundle mainBundle] loadNibNamed:@"xibview" owner:nil options:nil] lastObject];
// make sure customView is not nil or the wrong class!
if ([customView isKindOfClass:[CustomView class]])
return customView;
else
return nil;
}
4. xib의 Custom Class에 CustomView지정.
5. 사용
CustomView *cView = [CustomView customView];