答案 0 :(得分:0)
IBOutlet UIView * view1,* view2,* view3,* view4,* view5; //不要忘记在xib中连接
- (IBAction为)segValueChanged:(UISegmentedControl *)发送者; //使用SegmentedControl
在xib中连接此方法 <。>文件中的
- (IBAction为)segValueChanged:(UISegmentedControl *)发件人{
view1.hidden = TRUE;
view2.hidden = TRUE;
view3.hidden = TRUE;
view4.hidden = TRUE;
view5.hidden = TRUE;
switch(sender.selectedSegmentIndex) {
case 0:
view1.hidden = FALSE;
break;
case 1:
view2.hidden = FALSE;
break;
case 2:
view3.hidden = FALSE;
break;
case 3:
view4.hidden = FALSE;
break;
case 4:
view5.hidden = FALSE;
break;
}
}