我正在尝试创建一个简单的绘图应用程序。它具有一组控件,可以通过按下透明的 UIButton 来隐藏或显示。问题出在键盘上。每次键盘出现时,无论是键入标题还是创建文本框..动画都会自行重置和撤消......我不知道为什么会这样。
请帮帮我......这里发布了上下移动控件的代码: -
- (void) hideShowTopBarAnimated
{
if(self.isTopBarHidden == NO)
{
self.hideShowButtonPointingUp.alpha = 0.0;
[UIView animateKeyframesWithDuration:0.3
delay:0.0
options:UIViewKeyframeAnimationOptionBeginFromCurrentState
animations:^(void){
CGPoint center;
center = self.topBarImage.center;
center.y -= 80;
self.topBarImage.center = center;
center = self.titleBar.center;
center.y -= 80;
self.titleBar.center = center;
center = self.backgroundPicker.center;
center.y -= 80;
self.backgroundPicker.center = center;
center = self.writingPicker.center;
center.y -= 80;
self.writingPicker.center = center;
center = self.backgroundLabel.center;
center.y -= 80;
self.backgroundLabel.center = center;
center = self.penLabel.center;
center.y -= 80;
self.penLabel.center = center;
center = self.writeDrawToggle.center;
center.y -= 80;
self.writeDrawToggle.center = center;
center = self.invisibleBackgroundButton.center;
center.y -= 80;
self.invisibleBackgroundButton.center = center;
center = self.invisibleShowHideUIButton.center;
center.y -= 80;
self.invisibleShowHideUIButton.center = center;
}
completion:^(BOOL finished){
self.hideShowButtonPointingDown.alpha = 1.0;
}];
self.isTopBarHidden = YES;
}
else if(self.isTopBarHidden == YES)
{
self.hideShowButtonPointingDown.alpha = 0.0;
[UIView animateKeyframesWithDuration:0.3
delay:0.0
options:UIViewKeyframeAnimationOptionBeginFromCurrentState
animations:^(void){
CGPoint center;
center = self.topBarImage.center;
center.y += 80;
self.topBarImage.center = center;
center = self.titleBar.center;
center.y += 80;
self.titleBar.center = center;
center = self.backgroundPicker.center;
center.y += 80;
self.backgroundPicker.center = center;
center = self.writingPicker.center;
center.y += 80;
self.writingPicker.center = center;
center = self.backgroundLabel.center;
center.y += 80;
self.backgroundLabel.center = center;
center = self.penLabel.center;
center.y += 80;
self.penLabel.center = center;
center = self.writeDrawToggle.center;
center.y += 80;
self.writeDrawToggle.center = center;
center = self.invisibleBackgroundButton.center;
center.y += 80;
self.invisibleBackgroundButton.center = center;
center = self.invisibleShowHideUIButton.center;
center.y += 80;
self.invisibleShowHideUIButton.center = center;
}
completion:^(BOOL finished){
self.hideShowButtonPointingUp.alpha = 1.0;
}];
self.isTopBarHidden = NO;
}
}