//画图
-(void)addSecondZone:(UIView*)contentView
//按钮图片
UIImage *selecticonNo =[UIImageimageNamed:SelecticonNo];
UIImage *selecticon =[UIImageimageNamed:Selecticon];
UIView *childSecondView;
childSecondView = [[UIViewalloc] initWithFrame:CGRectMake(0,155 , 320, 500)];
int pointY =0;
for (int i=0;i<4;i++) {
[childSecondViewaddSubImageView:contentbar Rect:CGRectMake(0,pointY, 320,contentbar.size.height/2)];
UIButton *button = [UIButtonbuttonWithType:UIButtonTypeCustom];
[buttonsetBackgroundImage:selecticonNo forState:UIControlStateNormal];
[buttonsetBackgroundImage:selecticon forState:UIControlStateSelected];
button.frame=CGRectMake(310-selecticonNo.size.width/2,pointY+2, selecticonNo.size.width/2,selecticonNo.size.height/2);
[buttonsetTitleColor:[UIColorblackColor] forState:UIControlStateNormal];
button.tag=i +1;
[buttonaddTarget:selfaction:@selector(selectTransType:)forControlEvents:UIControlEventTouchUpInside];
if(i==0)
{
[buttonsetSelected:YES];
}
[childSecondViewaddSubview:button];
pointY += 40;
}
}
//单选框点击
-(void)selectTransType:(id)sender
{
//单选钮
UIImage *selecticonNo =[UIImageimageNamed:SelecticonNo];
UIImage *selecticon =[UIImageimageNamed:Selecticon];
UIButton *btn=nil;
for (int i=1;i<5;i++) {
btn = (UIButton *)[mainZoneviewWithTag:i]; //获取单选按钮 mainZone 是最外层的视图
if ([btnisSelected]) {
[btnsetBackgroundImage:selecticonNo forState:UIControlStateNormal];
[btn setSelected:NO];
}
}
[sendersetBackgroundImage:selecticon forState:UIControlStateSelected];
[sendersetSelected:YES];
}