iOS 在一个屏幕中根据不同的按钮创建不同的 view 求大神给个 设计后续的思路应该怎么做
#pragma mark - 初始化
- (void)initParamUI {
self.pViewContrllerArray = @[@"DiceBtnViewController",
@"LuckBtnViewController",
@"AccuracyBtnViewController"];
self.pMessageArray = @[@"摇骰子",@"拼手气",@"稳准狠"];
self.pTabIconSelectArray = @[@"Line",@"Line",@"Line"];
}
#pragma mark - 创建标签
- (void)createTally {
self.pDockImageView = [[XYImageView alloc]initWithFrame:CGRectMake(0, [super pBgScrollView].minY, SCREEN_WIDTH, XYONDockHeight)];
self.pDockImageView.userInteractionEnabled = YES;
self.pDockImageView.backgroundColor =UIColorFromRGB(0xFCFCFC);
[[super pBgScrollView] addSubview:self.pDockImageView];
float pBtnWidth = SCREEN_WIDTH/self.pViewContrllerArray.count;
for (int i = 0; i < self.pViewContrllerArray.count; i++) {
XYButton_Tabs *pBtn = [XYButton_Tabs buttonWithType:UIButtonTypeCustom];
pBtn.frame = CGRectMake(i*pBtnWidth, 0, pBtnWidth,XYONDockHeight);
pBtn.titleLabel.textAlignment = NSTextAlignmentCenter;
if (self.pTabIconNormalArray.count > 0) {
[pBtn setNormalImage:self.pTabIconNormalArray[i]];
}
if (self.pTabIconSelectArray.count > 0) {
[pBtn setSelectImage:self.pTabIconSelectArray[i]];
}
[pBtn setBoldFontSize:XYFontSize];
[pBtn addClickTarget:self action:@selector(selectViewControl:)];
[pBtn setNormalTitle:self.pMessageArray[i]];
[pBtn setTitleColor:XYFontNormalColor forState:UIControlStateNormal];
[pBtn setTitleColor:XYFontSelectColor forState:UIControlStateSelected];
[pBtn setTag:XYBtnTag+i];
[self.pDockImageView addSubview:pBtn];
//默认显示
if(i == XYCheckNum){
[pBtn setSelected:YES];
[pBtn setBackgroundColor:XYBtnBackground];
[pBtn setUserInteractionEnabled:NO];
self.pCurrentBtn = pBtn;
}
}
}