我的项目代码(cmnd + b)在 xcode 5.1.1 运行(cmnd + r)中使用模拟器iphone 5 ios 7.1生成以下内容
在 xcode 6.1.1 中运行相同的代码(cmnd + b)运行(cmnd + r)与模拟器iphone 5 ios 7.1产生以下内容
任何想法?
这是显示键盘的代码:
- (void)showKeyboard:(NSNotification*)notification
{
NSValue *keyboardEndFrameValue = [[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey];
CGRect keyboardEndFrame = [keyboardEndFrameValue CGRectValue];
NSNumber *animationDurationNumber = [[notification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey];
NSTimeInterval animationDuration = [animationDurationNumber doubleValue];
NSNumber *animationCurveNumber = [[notification userInfo] objectForKey:UIKeyboardAnimationCurveUserInfoKey];
UIViewAnimationCurve animationCurve = [animationCurveNumber intValue];
UIViewAnimationOptions animationOptions = animationCurve << 16;
int searchBarYPadding = 60;
if ([[UIDevice currentDevice].systemVersion floatValue] >= 7.0f)
{
searchBarYPadding = 42;
}
[UIView animateWithDuration:animationDuration
delay:0.0
options:animationOptions
animations:^{
CGRect textFieldFrame = self.addressSearchBar.frame;
textFieldFrame.origin.y = keyboardEndFrame.origin.y - searchBarYPadding;
self.addressSearchBar.frame = textFieldFrame;
}
completion:^(BOOL finished) {isKeyboardDisplayed = YES;}];
}