wimagguc / ios-custom-alertview

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

changeOrientationForIOS8 has bug #82

Open raymanound-zz opened 9 years ago

raymanound-zz commented 9 years ago

The direction of my application is forced to be portrait and I put a textfield in the alertview contentview. When the keyboard is showing, the alertview will still reposition to the center of screen while I move the phone. The iphone I test is iphone5 with ios8.4.

pabloburnio commented 8 years ago

Believe that I have the same issue, this happens regardless of orientation but is more pronounced in landscape (less space for keyboard and popup).

Hold your device vertically (like your monitor is), then tilt the screen back slowly so it starts to face the ceiling. The alertview will move down the screen behind the keyboard.

Issue is with 'changeOrientationForIOS8', on this line;

CGSize keyboardSize = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size;

keyboardSize is always nil as it doesn't receive notifications for this key.

Just about to create a pull request for this as I've made the changes. Also, swapped out

UIKeyboardFrameBeginUserInfoKey for UIKeyboardFrameEndUserInfoKey, as that represents the final size of they keyboard.