Ios6 是否更改iOS7中的UINavigation工具栏位置?

Ios6 是否更改iOS7中的UINavigation工具栏位置?,ios6,uinavigationcontroller,ios7,uitoolbar,uiviewanimation,Ios6,Uinavigationcontroller,Ios7,Uitoolbar,Uiviewanimation,有人知道如何在iOS7中更改工具栏的位置吗?我的工具栏上有一个文本字段,在编辑过程中出现键盘时需要查看该字段 在iOS6中,我只是设置了工具栏框架的动画并更改了工具栏的位置,但在iOS7中它似乎不起作用。在iOS7中有这样做的方法吗 - (void)textFieldDidBeginEditing:(UITextField *)textField { [UIView animateWithDuration:0.25 delay

有人知道如何在iOS7中更改工具栏的位置吗?我的工具栏上有一个文本字段,在编辑过程中出现键盘时需要查看该字段

在iOS6中,我只是设置了工具栏框架的动画并更改了工具栏的位置,但在iOS7中它似乎不起作用。在iOS7中有这样做的方法吗

- (void)textFieldDidBeginEditing:(UITextField *)textField
{   
     [UIView animateWithDuration:0.25
                           delay:0.0
                         options:UIViewAnimationOptionCurveEaseIn
                      animations:^{
                           [self.navigationController.toolbar 
                                  setFrame:
                             CGRectMake(0, self.view.bounds.size.height - 172, 320, 44)];
                      }
                      completion:nil];
}

我想出来了。我在动画中添加了另一个按钮,然后尝试在完成块中更改工具栏框架,结果成功了!另一个按钮就在那里,通过按下键盘外部的按钮来辞职FirstResponder。我不知道为什么会这样,但我没有抱怨:

- (void)textFieldDidBeginEditing:(UITextField *)textField
{   
    self.done = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 0)];
    self.done.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.5];
    [self.done  addTarget:self action:@selector(doneButton:) forControlEvents:UIControlEventTouchUpInside];
    [self.navigationController.view addSubview:self.done];

    [UIView animateWithDuration:0.25
                          delay:0.0
                        options:UIViewAnimationOptionCurveEaseIn
                     animations:^{
                         [self.done setFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height - 172 + 20)];
                     }
                     completion:^(BOOL finished) {
                         [self.navigationController.toolbar setFrame:CGRectMake(0, self.view.bounds.size.height - 172 + 20, 320, 44)];
                     }
     ];
}
我注意到的另一件事是,我无法更改工具栏的半透明属性。当我试图实施:

self.navigationController.toolbar.translucent = YES;
self.navigationController.toolbar.barStyle = UIBarStyleBlackTranslucent;
或者当我试图实施:

self.navigationController.toolbar.translucent = YES;
self.navigationController.toolbar.barStyle = UIBarStyleBlackTranslucent;
它导致动画完成块代码不工作。我不确定这是个bug还是什么