wimagguc / ios-custom-alertview

Custom UIAlertView. Continue adding images and UIViews to dialogs in iOS7+
Other
1.66k stars 394 forks source link

Alert disappears when a keyboard is presented in iOS 8 (landscape) #70

Closed oscarfung closed 9 years ago

oscarfung commented 9 years ago

Hi,

I tried to add a UITextView to the custom alert, but the alert will disappear when the keyboard is presented in iOS 8, landscape mode. I fix this issue by modifying the method -keyboardWillShow:

UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];
if (UIInterfaceOrientationIsLandscape(interfaceOrientation)  && NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_7_1) {
    CGFloat tmp = keyboardSize.height;
    keyboardSize.height = keyboardSize.width;
    keyboardSize.width = tmp;
}

Since iOS 8 will return the correct frame in landscape mode, we don't need to exchange its width and height. I add one more condition NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_7_1 to resolve this issue.

wimagguc commented 9 years ago

awesome, thanks! do you mind adding a pull request?

oscarfung commented 9 years ago

I will add a pull request, thanks!

oscarfung commented 9 years ago

Please check the pull request: https://github.com/wimagguc/ios-custom-alertview/pull/71

wimagguc commented 9 years ago

thanks @oscarfung, this is merged now :)