自己封装一个View
/在.h声明
@interface SelectView : UIView
@property(nonatomic,assign)NSInteger selectIndex;
- (instancetype)initWithTitle:(NSString *)title andItemArrar:(NSArray *)items;
@end
//在.m里面实现
#import "SelectView.h"
#import "Masonry.h"
@interface SelectView()
@property(nonatomic,strong)UILabel * titleLabel;
@property(nonatomic,strong)UIButton * selectBtn;
@property(nonatomic,strong)NSString * title;
@property(nonatomic,strong)NSArray * items;
@end
@implementation SelectView
- (instancetype)initWithTitle:(NSString *)title andItemArrar:(NSArray *)items{
if (! (self = [super init]))
return nil;
self.backgroundColor = [UIColor yellowColor];
_title = title;
_items = items;
[self addSubview:self.titleLabel];
[self layoutPageFrame];
[self addSubview:self.selectBtn];
return self;
}
//点击事件
- (void)selectBtnClick:(UIButton *)s