【发布时间】:2010-07-26 18:53:07
【问题描述】:
我的 iPhone 应用程序中的 UITextFields 出现问题,我希望这里的人可能以前见过。
我的屏幕上有几个 UITextField,当它们被点击并出现键盘时,它们被覆盖了。为了克服这个问题,我为视图设置了动画以向上移动:
-(void)moveViewUpFromValue:(float)fromOldValue toNewValue:(float)toNewValue keep:(BOOL)keep {
CABasicAnimation *theAnimation;
theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.translation.y"];
theAnimation.duration=0.25;
theAnimation.repeatCount=1;
if(keep) {
[theAnimation setRemovedOnCompletion:NO];
[theAnimation setFillMode:kCAFillModeForwards];
}
theAnimation.fromValue=[NSNumber numberWithFloat:fromOldValue];
theAnimation.toValue=[NSNumber numberWithFloat:toNewValue];
[self.view.layer addAnimation:theAnimation forKey:@"animateLayer"];
}
这在视觉上效果很好,但是,当我去编辑(按住屏幕以获得放大镜)时,它不会出现。交互被保留在它移动之前的位置。
有什么想法吗?
非常感谢, 布雷特
【问题讨论】:
标签: iphone objective-c uitextfield