mutualmobile / MMProgressHUD

An easy-to-use HUD interface with personality.
MIT License
705 stars 131 forks source link

iOS8 Rotation issue #30

Closed Boyeen closed 9 years ago

Boyeen commented 10 years ago

Seem to have a problem with landscape orientation in iOS8. The progress view is always in portrait.

TeacherTool commented 10 years ago

Same thing here. I realised there are, in general, lots of methods in iOS8 that were deprecated in iOS7 that do not get called anymore. Maybe we rely on one of them in the current version?

larsacus commented 10 years ago

Deprecated methods don't necessarily mean that they don't work anymore, it simply means that in some future iOS version they will be removed from the API and are considered unsupported. This should not be an issue if you are still compiling for iOS 7 using Xcode 5.1.1, but the behavior is probably breaking when compiled for iOS 8 using Xcode 6.

Can anyone attach some logs? I haven't yet had time to look at this.

TeacherTool commented 10 years ago

Deployment target is still iOS6, but you're right guessing I am using XCode6. In the meantime, I've figured out a q&d fix that works for iOS8 and 7 (could not test 6):

  1. Make the - (void)orientRootViewControllerForOrientation:(UIInterfaceOrientation)interfaceOrientation method in MMProgressHudWindow.m empty. Let it do nothing.
  2. Im MMProgressHud.m, change the - (CGPoint)_windowCenterForHUDAnchor:(CGPoint)anchor to the following:

    • (CGPoint)_windowCenterForHUDAnchor:(CGPoint)anchor {

    CGFloat hudHeight = CGRectGetHeight(self.hud.frame);

    CGPoint position; CGFloat systemVersion = [[[UIDevice currentDevice] systemVersion] floatValue]; if (UIInterfaceOrientationIsPortrait([[self.window rootViewController] interfaceOrientation]) || systemVersion>=8) {

    CGFloat y = roundf(self.window.center.y + (anchor.y - 0.5f) * hudHeight);
    CGFloat x = roundf(self.window.center.x);
    
    position = CGPointMake(x, y);

    } else if (UIInterfaceOrientationIsLandscape([[self.window rootViewController] interfaceOrientation])) { CGFloat x = roundf(self.window.center.y); CGFloat y = roundf(self.window.center.x + (anchor.y - 0.5f) * hudHeight);

    position = CGPointMake(x, y);

    }

    return [self _antialiasedPositionPointForPoint:position forLayer:self.hud.layer]; }

Maybe you'll find some hints here for a perfect fix. BTW How do I mark preformatted text and quotes in this editor?

EugeneRash commented 10 years ago

Fix from @TeacherTool works Thanks, you save a lot of time :)

btelintelo commented 10 years ago

Are there any plans to push a new release with a fix?

larsacus commented 10 years ago

I have not had time to look into this issue with the attention that it requires. Does anyone know if the fix above also works for projects compiled with Xcode 5.1.1 running on both iOS 7 and 8, or does this fix only work when compiled in Xcode 6 with iOS 8 as the deployment target?

btelintelo commented 10 years ago

We copied the source code into our project, removing it from our cocoa pods. We applied the changes from @TeacherTool and everything works fine now. We are using xcode 6 with target sdk 7.0.

MrRochito commented 10 years ago

@TeacherTool Thanks a lot! for your code and thanks for this controller.

greetings from México

skydivedan commented 10 years ago

OK, so can someone rev the podspec? I just spent a bunch of time switching away from SVProgressHUD, and discovered this after I finished all the work.

larsacus commented 9 years ago

Can everyone who is having rotation issues please take a look at ee50263 and see if this resolves the issue? I tried to break it with the fix I made and could not on all 6.x->8.x platforms.

larsacus commented 9 years ago

I just pushed v0.3.0 with these changes to fix this -- reopen this issue if this issue still persists.

lixianyu commented 9 years ago

I have do a test, it is still not work on iPad(iOS8.1.1). I try to fix it, but failed.

jeremymedford commented 9 years ago

I just updated our Podfile to use 0.3.0. Doing clean installs of Debug builds on iOS8.1 in the simulator and on an iPad Mini Retina still exhibit the issue. It is definitely happening with the following call:

MMProgressHUD showWithTitle:
vincentjames501 commented 9 years ago

+1. This is still an issue. While my PR is a hack, it does seem to work (at least for me).

larsacus commented 9 years ago

It would help very much if someone who is experiencing the issue to try and debug what specifically the problem is. As it stands, I currently cannot reproduce issues with rotation like everyone is describing on the latest code from the master branch using the example app in the Demo/ folder. Some questions I have for everyone having issues:

  1. Is this on all versions of iOS 8 (iOS 8, iOS 8.1, etc)?
  2. Is the deployment target for your app iOS 7+, or is it iOS 8-only?
  3. Are you using UIViewController-based status bar methods?
  4. Are you using UIViewController-based rotation methods?
  5. What exactly does it do when it "doesn't work"? Does it not rotate at all, does it rotate, but look broken, etc?

Like I said, I cannot reproduce this issue anymore, which makes it extremely difficult to fix.

vincentjames501 commented 9 years ago

Here are some images and a description from our QA team's bug report: On the current iOS staging build on iPhone 6 and 6+ if you tap to record audio while composing a message in landscape the audio record icon shows up incorrectly and if you rotate to portrait it does not correct itself.

Opening in portrait the audio icon is orientated appropriately but if you switch to landscape it gets out of whack.

See attached images for examples.

http://imgur.com/a/rDR42

Is this on all versions of iOS 8 (iOS 8, iOS 8.1, etc)? iOS 8+ Is the deployment target for your app iOS 7+, or is it iOS 8-only? iOS 7+ Are you using UIViewController-based status bar methods? No Are you using UIViewController-based rotation methods? No What exactly does it do when it "doesn't work"? Does it not rotate at all, does it rotate, but look broken, etc? See description above

jeremymedford commented 9 years ago

Is this on all versions of iOS 8 (iOS 8, iOS 8.1, etc)? iPad Mini w/ 8.1.2: YES iPad simulators with 8.1: YES Is the deployment target for your app iOS 7+, or is it iOS 8-only? Deployment Target of 7.0. Are you using UIViewController-based status bar methods? No Are you using UIViewController-based rotation methods? No What exactly does it do when it "doesn't work"? Does it not rotate at all, does it rotate, but look broken, etc? We initiate the display of it and it remains in the incorrect orientation throughout the duration of it being displayed. When the device is in any orientation besides the default portrait mode, it is always aligned with the default portrait mode. I've attached two images. One in landscape and one in 'upside-down' or reverse portrait mode. img_0022 img_0021

jeremymedford commented 9 years ago

If it helps, at the time this was presented from LoginContainerViewController, this is the hierarchy:

<SplashViewController 0x7ae3d240>, state: disappeared, view: <UIView 0x7be91a70> not in the window
   + <LoginContainerViewController 0x7bea67a0>, state: appeared, view: <UIView 0x7bea7f90>, presented with: <_UIFullscreenPresentationController 0x7bea6d80>
   |    | <LoginViewController 0x7b86b850>, state: appeared, view: <UIView 0x7bead6b0>
   |    | <SelectMerchantViewController 0x7beaa360>, state: appeared, view: <UITableView 0x7c2dee00>
joolskii commented 9 years ago

Hi,

I've just updated to version 3.0.0, and I'm hitting this issue too.

My application uses UIInterfaceOrientationLandscapeRight and UIInterfaceOrientationLandscapeLeft orientations only, however I've found that the MMProgressHUDWindow is being oriented incorrectly.

Looking at - (void)orientRootViewControllerForOrientation:(UIInterfaceOrientation)interfaceOrientation on MMProgressHUDWindow I've checked that the interfaceOrientation being passed is correct however, the applied transform is orienting the window incorrectly.

I've fixed my code for the moment by simply using a transform of 0, but I suspect this is not the complete solution.

--J

btelintelo commented 9 years ago

We are having this issue also. iOS 8 with a deployment target of 7.1. We managed to pull down the source for 2.3, fix the rotation issue, but now we are seeing a problem with the progress spinniner not dismissing properly sometimes and locking up the app. v 0.30 is still broken.

larsacus commented 9 years ago

Is anyone on this thread having issues with rotation on iPhone, or is it only on iPad that this issue manifests itself?

larsacus commented 9 years ago

And as a follow-up can anyone reproduce this issue using the sample project included in this repo?

larsacus commented 9 years ago

I just pushed up 0.3.1 to CocoaPods. This has some other fixes, but there was one commit related to rotation that might actually fix what everyone is talking about in here and might be why I have not been able to reproduce this issue. If this is true, this is my bad for not pushing a release with that one commit in it prior to this.

Please try 0.3.1 out, let me know how it works out, and have an awesome weekend, everyone! :beers: