wimagguc / ios-custom-alertview

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

iOS8 Alertview Rotation Issue #59

Closed shahshrenik closed 9 years ago

shahshrenik commented 9 years ago

landscape ipad portrait ipad

Hello,

I am still facing rotation issue in iPad 2.0 with iOS 8.0. I m sure iPad mini will have still the same issue

See the images..Issues is in Landscape orientations.. AlertView's background is not getting resized and hence Alert is not displayed in the centre.

If I open an alert in Portrait mode, and change device's orientation to Landscape, at that time there is some problem in resizing the screenSize. And due to this , Alert is not displayed in the center of the screen

Have to modify the orientationDidChange code as it is only working currently with OS 7.1 or lower version. Transformation is not handled properly

WizKIDz commented 9 years ago

still problems... even with iPhone... good control though. id love to use it in an upcoming app with this issue fixed

anandgupadhyay commented 9 years ago

I have solved this issue, for my code, just set parentview property of alertview. and use new screen size for ioS8 add below code to class and use it instead of [UIScreen mainscreen].bounds.size

+ (CGSize)screenSize {
    CGSize screenSize = [UIScreen mainScreen].bounds.size;
    if ((NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_7_1) && UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
        return CGSizeMake(screenSize.height, screenSize.width);
    }
    return screenSize;
}

remove below code from countScreenSize and keyboardWillShow method.

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

Thats it, you are done.

wimagguc commented 9 years ago

Rotation should be sorted for IOS8+ and IOS7. I'm closing the related issues now, please reopen a new one if necessary.