我需要在我目前的viewcontroller中弹出tabbar上方的动作表,但它不应该与tabbar重叠(我需要清楚地看到tabbar)

时间:2013-01-07 10:07:13

标签: objective-c ios6 uikit uiactionsheet

我需要在我目前的viewcontroller中弹出tabbar上方的transperant动作表,但它不应该与tabbar重叠(我需要清楚地看到tabbar)。

1 个答案:

答案 0 :(得分:0)

要在UIActionsheet上创建transparant背景,您必须设置委托,然后您可以这样做:

- (void)willPresentActionSheet:(UIActionSheet *)actionSheet {
    [actionSheet.layer setContents:nil];
}


要创建一个从底部开始动画的自定义UIView,您可以执行>

bottomView = [[UIView alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height, self.view.frame.size.width, 250)];
bottomView.backgroundColor = [UIColor redColor];
bottomView.hidden = YES;
[self.view addSubview:bottomView];

UIButton *testButton = [UIButton buttonWithType:UIButtonTypeCustom];
testButton.frame = CGRectMake(20, 50, 280, 40);
testButton.backgroundColor = [UIColor greenColor];
[bottomView addSubview:testButton];

[self animateBottomViewIn];

并有以下方法:

-(void)animateBottomViewIn
{
    bottomView.hidden = NO;
    [UIView animateWithDuration:0.3 animations:^{
        bottomView.frame = CGRectMake(0, self.view.frame.size.height - bottomView.frame.size.height, self.view.frame.size.width, bottomView.frame.size.height);
    } completion:^(BOOL finished) { }];
}

-(void)animateBottomViewOut
{
    [UIView animateWithDuration:0.3 animations:^{
        bottomView.frame = CGRectMake(0, self.view.frame.size.height, self.view.frame.size.width, bottomView.frame.size.height);
    } completion:^(BOOL finished) {
        bottomView.hidden = YES;
    }];
}