viezel/TiSocial.Framework

Stop Orientation Change?

Opened this issue · 10 comments

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.

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

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!

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

Thanks

@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 :)

@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?

@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

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

Right below the imports.

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

@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.

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.