iOS: xib自定义view的模版小记

来源:互联网 发布:apache ant 安装配置 编辑:程序博客网 时间:2024/05/17 06:11

#import "CustomView.h"@interface CustomView(Private)@property (nonatomic, weak) IBOutlet UIButton *btnNew;@property (nonatomic, weak) IBOutlet UIButton *btnEdit;@property (nonatomic, weak) IBOutlet UIButton *btnDelete;@property (nonatomic, weak) IBOutlet UIButton *btnCancel;@end@implementation CustomView+ (CustomView *)instanceWithFrame:(CGRect)frame{    CustomView *view = (CustomView *)[[NSBundle mainBundle] loadNibNamed:@"CustomViewXib" owner:nil options:nil][0];    view.frame = frame;    return view;}//1- (id)initWithCoder:(NSCoder *)aDecoder {    self = [super initWithCoder:aDecoder];    if (self) {            }    return self;}//2- (void)awakeFromNib {    [super awakeFromNib];}//3- (void)willMoveToSuperview:(UIView *)newSuperview {    if (newSuperview) {            }}//4- (void)layoutSubviews {    [super layoutSubviews];        }@end


0 0