IOS 8 not working

I have a view that I want to change when the keyboard is displayed, I use the UIKeyboardWillShowNotification delegate to update the position, and it works fine on the iOS 7 device, but when I try to run it on the iOS 8 device, then the view is not reset , the frame is updated since I see him in a magazine.

following my code

-(void) keyboardWillShow:(NSNotification*) notification{ @autoreleasepool { CGRect frame = _loginFrame.frame; frame.origin.y-=200; DLog(@"login frame %@ ",NSStringFromCGRect(frame)); [UIView animateWithDuration:0.25 animations:^{ [_loginFrame setFrame:frame]; }]; } 

}

But, when I try animation in dispatch_after to block its animation to a new position

  dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [UIView animateWithDuration:0.25 animations:^{ [_loginFrame setFrame:frame]; }]; }); 

any idea why the frame is not animated to a new position without sending_send?

Thanks!

NOTE: the setFrame: method does not seem to work , I don’t know why, I created a basic ios 8 application to test this

2014-09-11 18: 59: 54.836 KeyboardCheck [31215: 1451974] keyboard show 2014-09-11 18: 59: 54.837 KeyboardCheck [31215: 1451974] old frame {{60, 269}, {200, 30}} 2014 -09-11 18: 59: 54.837 KeyboardCheck [31215: 1451974] update frame {{60, 169}, {200, 30}} 2014-09-11 18: 59: 55.339 KeyboardCheck [31215: 1451974] completion block-block {{60, 269}, {200, 30}} 2014-09-11 18: 59: 55.822 KeyboardCheck [31215: 1451974] hide the keyboard 2014-09-11 18: 59: 55.822 KeyboardCheck [31215: 1451974] old frame { {60, 269}, {200, 30}} 2014-09-11 18: 59: 56.324 KeyboardCheck [31215: 1451974] completion block {{60, 269}, {200, 30}}

+5
source share
1 answer

I solved the problem by unchecking the Use automatic layout box.

If you want automatic layout, here is another possible solution:

https://teamtreehouse.com/forum/animating-views-does-not-seem-to-work-in-ios8-but-did-in-ios7

+3
source

Source: https://habr.com/ru/post/1202340/


All Articles