Skip to content
This repository has been archived by the owner on Apr 8, 2021. It is now read-only.

Stop Orientation Change? #146

Open
dlewis23 opened this issue Jul 17, 2015 · 10 comments
Open

Stop Orientation Change? #146

dlewis23 opened this issue Jul 17, 2015 · 10 comments

Comments

@dlewis23
Copy link

Does anyone know how to stop orientation change when an activity view comes up?

Currently my iPhone app does not allow orientation change but when an action view comes up if the user rotates there iPhone it will change the orientation of my app till they rotate back.

@dlewis23
Copy link
Author

dlewis23 commented Aug 5, 2015

I still have not been able to figure this one out. Has anyone ever gotten it to stop rotating?

@juanjimenez-6
Copy link

In order for it to not rotate, I had to modify DkNappSocialModule's files.
No actual way to do it from Titanium, at least not from what I've read so far. In Titanium you can only listen to orientationchanges and reflect changes in Window objects.

But right now, version 1.8.2 is broken for tablets (at least for me #149), so you would need to modify it on 1.8.0 version files.
I'm creating a merge request with said changes. Will send it in a few to help!

@dlewis23
Copy link
Author

dlewis23 commented Sep 7, 2015

JuanP6 were you able to create that request so I can see what you changed to stop orientation change?

Thanks

@juanjimenez-6
Copy link

@dlewis23 sorry, I've been swamped.
I wanted to take the activityPopover and activityView and make them take a parameter with the accepted orientations, instead of forcing it not to rotate like I'm doing right now.

In the meantime, I can share with you my custom build of 1.8.2 with the rotation disabled, if @viezel does not have a problem with that :)

@dlewis23
Copy link
Author

dlewis23 commented Sep 8, 2015

@JuanP6 So you disabled rotation on both the iPad share popup and iPhone view? Did you have to just add a line or two or make some major changes?

@juanjimenez-6
Copy link

@dlewis23 indeed. I disabled it for all scenarios. It will just be disabled once the share view is active, after you close it the behavior will be the one you set up in your titanium config.

There are a few lines added in both the interface and the class (DkNappSocialModule)

  • (BOOL) shouldAutorotate {
    return NO;
    }
  • (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskPortrait;
    }
  • (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
    return UIInterfaceOrientationPortrait;
    }
  • (BOOL)shouldAutorotateToInterfaceOrientation {
    return NO;
    }

But once again, the latest on this repo (1.8.2) is crashing for iPads, so you have to rollback activityPopover to what it was on 1.8.0

@dlewis23
Copy link
Author

@JuanP6 Where in the interface did you add that too?

@juanjimenez-6
Copy link

Right below the imports.

screen shot 2015-10-22 at 9 55 31 am

@dlewis23
Copy link
Author

@JuanP6 That worked great. Thanks for that. I also want to add that I do not have the issue you are having with the app crashing on iPad. If I set the view to display on a plain view I have no issue and the app works just fine so far. But if I set the view to a button it crashes with the same error you have.

@juanjimenez-6
Copy link

Awesome. The least I could do to be helpful in some way. I wanted to actually create a method to receive an array of the orientations I want to support but that will be for a future release of my project.

Regarding the iPad issue, that's great to know. For some reason that's not my case, but I think I never mentioned in #149 how I fixed it, so I'm gonna do it right now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants