- (void)viewDidLoad { [super viewDidLoad]; _rightView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height - 60)]; _rightView.backgroundColor = [UIColor blueColor]; [_baseView addSubview:_rightView]; _leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height - 60)]; _leftView.backgroundColor = [UIColor greenColor]; [_baseView addSubview:_leftView]; // Do any additional setup after loading the view from its nib. } - (IBAction)didClicked:(id)sender { UIButton *button = (UIButton *)sender; NSInteger tag = button.tag - 100; switch (tag) { case 0: { [_baseView bringSubviewToFront:_leftView]; } break; case 1: { [_baseView bringSubviewToFront:_rightView]; } break; default: break; } }