// Draw
-(Void) addSecondZone :( UIView *) contentView
// Button Image
UIImage * selecticonNo = [UIImage imageNamed: SelecticonNo];
UIImage * selecticon = [UIImage imageNamed: Selecticon];
UIView * childSecondView;
Childseconddview = [[UIView alloc] initWithFrame: CGRectMake (0,155,320,500)];
Int pointY = 0;
For (int I = 0; I <4; I ++ ){
[ChildSecondView addSubImageView: contentbar Rect: CGRectMake (0, pointY, 320, contentbar. size. height/2)];
UIButton * button = [UIButton buttonWithType: UIButtonTypeCustom];
[Button setBackgroundImage: selecticonNo forState: UIControlStateNormal];
[Button setBackgroundImage: selecticon forState: UIControlStateSelected];
Button. frame = CGRectMake (310-selecticonNo.size.width/2, pointY + 2, selecticonNo. size. width/2, selecticonNo. size. height/2 );
[Button setTitleColor: [UIColor blackColor] forState: UIControlStateNormal];
Button. tag = I + 1;
[Button addTarget: self action: @ selector (selectTransType :) forControlEvents: UIControlEventTouchUpInside];
If (I = 0)
{
[Button setSelected: YES];
}
[ChildSecondView addSubview: button];
PointY + = 40;
}
}
// Single click
-(Void) selectTransType :( id) sender
{
// Single button
UIImage * selecticonNo = [UIImage imageNamed: SelecticonNo];
UIImage * selecticon = [UIImage imageNamed: Selecticon];
UIButton * btn = nil;
For (int I = 1; I <5; I ++ ){
Btn = (UIButton *) [mainZone viewWithTag: I]; // obtain the single-choice button. mainZone is the outermost view.
If ([btn isSelected]) {
[Btn setBackgroundImage: selecticonNo forState: UIControlStateNormal];
[Btn setSelected: NO];
}
}
[Sender setBackgroundImage: selecticon forState: UIControlStateSelected];
[Sender setSelected: YES];
}