我想创建一个非常简单的 customView,上面有几个 UIlabel,我应该怎么做。任何教程或建议将不胜感激。我是新手,以前没试过。
我用xib试过这个。
@interface MyCustomView : UIView
@property (strong, nonatomic) IBOutlet UILabel *Label;
@end
执行
#import "MyCustomTimer.h"
@implementation MyCustomView
-(id)initWithCoder:(NSCoder *)aDecoder{
if ((self = [super initWithCoder:aDecoder])){
[self addSubview:[[[NSBundle mainBundle] loadNibNamed:@"MyCustomView" owner:self options:nil] objectAtIndex:0]];
}
return self;
}
@end
但我需要以编程方式进行,请帮助。谢谢