Giter Site home page Giter Site logo

Comments (5)

timeflying avatar timeflying commented on July 24, 2024

2 years past, the bug still there on iOS 10

  1. First on Portrait view ( Fine )
    simulator screen shot 26 may 2017 2 48 20 pm

  2. Rotate to landscape
    simulator screen shot 26 may 2017 2 48 26 pm

  3. Rotate back to portrait
    simulator screen shot 26 may 2017 2 48 30 pm

No one want to solve this bug?

from ios-custom-alertview.

rayalarajee avatar rayalarajee commented on July 24, 2024

Did you got soultion for this i am facing same issue

from ios-custom-alertview.

kemalserkan avatar kemalserkan commented on July 24, 2024

@rayalarajee
Try to look and solve as soon as possible time.

from ios-custom-alertview.

rayalarajee avatar rayalarajee commented on July 24, 2024

Could you please let me know if you found soultion @kemalserkan @timeflying

from ios-custom-alertview.

andymedvedev avatar andymedvedev commented on July 24, 2024

@rayalarajee @timeflying Hey there!
I Don't know why but when orientation changes screen size remains previous.

Here is the solution or fix:

- (void)changeOrientationForIOS8: (NSNotification *)notification {
    
    CGFloat screenWidth = [UIScreen mainScreen].bounds.size.width;
    CGFloat screenHeight = [UIScreen mainScreen].bounds.size.height;
    UIDevice  *device = notification.object;
    
    CGFloat minDim = MIN(screenWidth, screenHeight);
    CGFloat maxDim = MAX(screenWidth, screenHeight);
    
    switch (device.orientation)
    {
            case UIDeviceOrientationPortrait:
            screenWidth = minDim;
            screenHeight = maxDim;
            break;
            
            case UIDeviceOrientationLandscapeLeft:
            screenWidth = maxDim;
            screenHeight = minDim;
            break;
            
            case UIDeviceOrientationLandscapeRight:
            screenWidth = maxDim;
            screenHeight = minDim;
            break;
            
            case UIDeviceOrientationPortraitUpsideDown:
            screenWidth = minDim;
            screenHeight = maxDim;
            break;
            
            default:
            break;
    }
    
    [UIView animateWithDuration:0.2f delay:0.0 options:UIViewAnimationOptionTransitionNone
                     animations:^{
                         CGSize dialogSize = [self countDialogSize];
                         CGSize keyboardSize = [[[notification userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
                         self.frame = CGRectMake(0, 0, screenWidth, screenHeight);
                         self->dialogView.frame = CGRectMake((screenWidth - dialogSize.width) / 2, (screenHeight - keyboardSize.height - dialogSize.height) / 2, dialogSize.width, dialogSize.height);
                     }
                     completion:nil
     ];
}

and don' forget to pass [UIDevice currentDevice] as object to notification in init:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deviceOrientationDidChange:) name:UIDeviceOrientationDidChangeNotification object:[UIDevice currentDevice]];

from ios-custom-alertview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.