Skip to content
This repository has been archived by the owner on Jan 12, 2019. It is now read-only.

CardIOView rotating when rotation is not desired #117

Closed
paultiarks opened this issue Jun 3, 2015 · 7 comments
Closed

CardIOView rotating when rotation is not desired #117

paultiarks opened this issue Jun 3, 2015 · 7 comments
Labels

Comments

@paultiarks
Copy link

CardIOView seems to be ignoring allowFreelyRotatingCardGuide causing the scanner to appear incorrectly rotated in some cases. For instance when not using the scanner view full screen on iPhone and only supporting portrait orientation causes the scanner view to rotate (while the rest of the app's UI stays in portrait) when the device is rotated to landscape.

Is this a bug with the SDK or is there something I'm doing wrong?

@paultiarks paultiarks changed the title CardIOView rotating when rotation is not desired CardIOView rotating when rotation is not desired Jun 3, 2015
@dgoldman-pdx
Copy link
Member

@paultiarks to prevent the CardIOView from rotating, try this:

  • set allowFreelyRotatingCardGuide to NO
  • set the UISupportedInterfaceOrientation settings in your app's plist to include only Portrait (bottom home button)

The latter is not strictly required, as CardIOView should respect whatever rotation constraints are imposed by the containing ViewController. But the app plist UISupportedInterfaceOrientation setting should override any other constraints.

@paultiarks
Copy link
Author

@dgoldman-ebay Performed both of these and the guide still rotates on device rotation for me. I could supply a test project if you're not able to reproduce on your end, or let me know any other way I could assist.

@dgoldman-pdx
Copy link
Member

@paultiarks I am able to reproduce this problem. So far it's not apparent to me why this is no longer working. I will have to dig deeper...

Thanks for bringing this issue to our attention!

@dgoldman-pdx dgoldman-pdx added bug and removed question labels Jun 4, 2015
@dgoldman-pdx
Copy link
Member

@paultiarks This is rather interesting. I'm reasonably sure that a year or two ago I extensively tested this part of the code, and all was well. But I agree with you that it's not working now.

When allowFreelyRotatingCardGuide is set to NO, the card.io code follows the UIResponder chain upward from the CardIOView to find the first UIViewController. It then calls that viewcontroller's supportedInterfaceOrientations method, and the result determines the allowable orientations for the card guide.

So please take a close look at your view controller's supportedInterfaceOrientations method. Presumably it's not returning what you'd expect.

In the case of card.io's CardIOPaymentViewController, all of my tests today indicate that iOS is failing to do what it promises to do in the default [UIViewController supportedInterfaceOrientations] method; namely, intersecting the results with the UISupportedInterfaceOrientations value from the app's plist. I will probably update our code to do this intersection on its own.

(You can probably simply fix this in your view controller's supportedInterfaceOrientations method itself, rather than worrying about the plist.)

dgoldman-pdx pushed a commit to card-io/card.io-iOS-source that referenced this issue Jun 9, 2015
@paultiarks
Copy link
Author

@dgoldman-ebay This fixes the issue enough that I think we can consider it closed. If this is fixed in your code such that we don't have to override supportedInterfaceOrientation then an update on this thread would be appreciated, if at all possible, so we can pull that new version in. Thank you for your time and assistance!

@tomwhipple
Copy link
Member

Since @dgoldman-ebay has moved on to other things, I'm going to close this. Should someone decide to submit a pull request, we will review it. ;)

@dgoldman-pdx
Copy link
Member

Fixed in Version 5.1.0.

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

No branches or pull requests

3 participants