Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS 8 layout wrong #74

Closed
MaxHasADHD opened this issue Aug 17, 2014 · 50 comments
Closed

iOS 8 layout wrong #74

MaxHasADHD opened this issue Aug 17, 2014 · 50 comments

Comments

@MaxHasADHD
Copy link

On iOS 8 the passcode bubbles appear in the top left. Probably changes in auto layout or something messed it up.

@ohayon
Copy link

ohayon commented Sep 10, 2014

bump

@VinsonLi
Copy link

I got the same problem

@MaxHasADHD
Copy link
Author

Ya, Im going to have to use another library soon if this is not fixed in a day or 2, I need to submit this app ASAP

@alexsorokoletov
Copy link
Contributor

Which one are you going to use?

@sbhhbs
Copy link

sbhhbs commented Sep 12, 2014

Exactly the same problem

@rolandleth
Copy link
Owner

Yes, it's the autolayout, but I have no idea why it's not working anymore; it makes no sense, or I'm missing something really obvious. If visual constraints are used, it works, but visual representation isn't enough for what's needed.

Feel free to have a look, it might make some people happy, if solved :)

@bigboxsoftware
Copy link

Layout is fine on an iPad in iOS 8, it's just the phone view that's wrong.

@pixpax
Copy link

pixpax commented Sep 12, 2014

Yes, fixing this for iPhone would make some people verrrry happy :)

@bigboxsoftware
Copy link

I've started working on this. In the auto layout code, around line 500 in the LTHPasscodeViewController, creating the constraint against the animating view for all the items makes the layout correct, e.g. for the passcode, but this is needed for all of them.

NSLayoutConstraint *enterPasscodeConstraintCenterX =
[NSLayoutConstraint constraintWithItem: _enterPasscodeLabel
attribute: NSLayoutAttributeCenterX
relatedBy: NSLayoutRelationEqual
toItem: _animatingView
attribute: NSLayoutAttributeCenterX
multiplier: 1.0f
constant: 0.0f];

I need to understand in more detail how this works before claiming any success if fixing it, but if anyone else is looking at the problem, this may be the area to focus on.

@rolandleth
Copy link
Owner

Changing the toItem on the constraints from self.view to _animatingView did the trick and it makes sense, thanks!

I now need to fix another bug with the keyboard not appearing on iOS 7 and I will push the changes and update the pod. Today, hopefully.

@rolandleth
Copy link
Owner

I don't have an iPad to test, nor an iOS 7 iPhone and the simulator is acting stupid regarding becomeFirstResponder, but at least everything works on iOS 8. If you guys find a problem on iOS 7, please let me know.

@bigboxsoftware
Copy link

I will test on an iPad running iOS 7, an iPhone 4 running iOS7 and and an iPhone 5 running iOS8 and let you know if there's any issues

@rolandleth
Copy link
Owner

Awesome, thanks!

@bigboxsoftware
Copy link

My implementation of the _animatingView change is working on all my devices. I'll test your new code once it's pushed here.

@rolandleth
Copy link
Owner

The code was pushed, but found another bug, so I will push again in a few mins. Tested it on iPhone iOS 7 and 8 and it everything works.

@bigboxsoftware
Copy link

That looks good to me for portrait on all devices. On the iPad, in landscape it's not centred, and the error message appears under the keyboard. Just looking at the code now, but is this related to this issue or should I open a new issue?

@rolandleth
Copy link
Owner

I can't really test on the iPad, the simulator acts really weird and I don't have a device :(

If you (or anyone else) want to look at it and try a fix, I'd be grateful.

@MaxHasADHD
Copy link
Author

It looks great on the iPhone! Thanks for fixing!

@mdunnbarracuda
Copy link

Anyone having any luck with this?

@bigboxsoftware
Copy link

It's very hard to fix. Because the UIView is added to the top window, it doesn't receive rotate events. So the library applies a rotate transform to the view which rotates it 90 degrees, but this doesn't help with layout.

I've had to switch to my own simpler lock screen - where I apply a neutral image view on the app going into the background, and then present a lock view controller on the app coming to the front.

@frankai
Copy link

frankai commented Sep 30, 2014

Any update on this? If you rotate the iPad while the enter passcode screen is visible the layout doesn't work fine. Tested on iPad with iOS 8.0.2

@ddaddy
Copy link
Contributor

ddaddy commented Oct 9, 2014

I'm also looking for a quick fix to the iPad layout problem after rotation. I don't really understand the layout code sorry, I tend to use .xib's for all my auto layout stuff.

@mathiasgithub
Copy link

Anyone found a fix for this?

@stoncle
Copy link

stoncle commented Oct 12, 2014

change the constraints that relate to self.view to _animatingView would fix the layout, this may be because the self.view is not the direct container of the views we create, but _animatingView is.(iOS 8 bug?)
But the rotation still not working properly.

@ohayon
Copy link

ohayon commented Oct 15, 2014

any status on a fix for this?

@rolandleth
Copy link
Owner

Please try 3.2.1 and let me know if it works. Worked on my machine, but I could use some confirmations.

Thanks!

@ddaddy
Copy link
Contributor

ddaddy commented Oct 16, 2014

Seems to work fine on the iPad simulator :)

Thank you.

@rolandleth
Copy link
Owner

Sounds good. I could use a couple of more confirmations, preferably on a device and/or real app before I close this.

Cheers!

@nickafkhami
Copy link

Hey, thanks a lot for this great lib! I currently have the problem on iPhone 6 that the content view is completely blank, only the nav bar and keyboard render correctly, so for instance "Enter your passcode" and the dashed line aren't displayed. However, on the iPhone 6 simulator everything is fine.

@rolandleth
Copy link
Owner

It works on my iPhone 6.

@nickafkhami
Copy link

@rolandleth This is really strange. In your demo project it always works but in my app it only works after the second launch, not at the first run. I am looking further into it and trying to figure out why.

In a table view controller on a navigation controller stack I call this:

[[LTHPasscodeViewController sharedUser] showForEnablingPasscodeInViewController:self asModal:YES];

@alexsorokoletov
Copy link
Contributor

If you unlock the device in landscape mode, you will see correct layout now on iOS8.
But if you then (without going to another app or doing anything else) just rotate device to portrait mode, everything breaks again - PIN characters (4 dots) are not aligned correctly.

iOS 8.1, iPhone 5s

@guillermomuntaner
Copy link
Contributor

@alexsorokoletov same here. Layout is correctly loaded and displayed in the App orientation, but rotation breaks it.

To me it looks like layout is calculated for current orientation, but it is not being recalculated when rotation happens.

PD: There is a readme where it is said that for iPhone's only portrait is supported. However, it still rotates and presents in Landscape in my iPhone 5S with iOS8.

@nickafkhami
Copy link

In case you're interested: I have fixed the bug that I had, although I am still not sure why it occurred. I only know that any call I made to LTHPasscodeViewController in my app delegate's initialize method caused the passcode view controller not to work properly during the first app session (only killing the process and restarting the app - not resuming - would make it work). Removing these calls from initialize as well as moving the same code to application:didFinishLaunchingWithOptions: solves the problem. However, I can still not reproduce this with the demo project. There must be something else unique to my app's behaviour that I have overlooked.

@stoncle
Copy link

stoncle commented Jan 3, 2015

The rotation act abnormally because the status bar orientation observers are removed in _dismissMe method, and after this, they are not added again, so the view won't rotate after the first passcode view dismissing(only at the first time the passcode view would rotate.

To fix this, the only thing we have to do is, move the "addObserver" code which related to status bar orientation from the _addObserver method(the last 2) to viewWillAppear: method. This shall fix the rotation problem!

Hope this could help u.

@rolandleth
Copy link
Owner

Added the code in the latest version, thanks! Do you think I can close this, or does it require further testing? I didn't have anything else besides an iPhone 6 to test it on.

@stoncle
Copy link

stoncle commented Jan 20, 2015

well, there still exists some problems in rotation methods. In some cases, the desiredOrientation didn't return the correct orientation. It isn't a big problem, but it actually exists.(for example, rotate after clicking the cancel).

@rolandleth
Copy link
Owner

Fixed in 3.6.8.

@6axter82
Copy link

Hi,I have got to views A and B. I'm getting problem with my iPad version of a "change passcode" view, which is B. The first time I am going from A to B the layout is shown correctly, just as I expect. Than I press back button which brings me to view A and I rotate the iPad. After going again to the view B ("change passcode" view) I get the blank screen.

Applying
LTHPasscodeViewController.sharedUser().updateViewConstraints()
did not improve the situation much. Do you have any suggestions what to do?

@rolandleth
Copy link
Owner

Hey,

Can you reproduce the bug in the demo app? If yes, can you provide a sample project based on the demo app(preferred)/steps to reproduce, please? Would be easier to track down the issue.

Maybe LTHPasscodeViewController.sharedUser().view.layoutIfNeeded()?

@6axter82
Copy link

Hi again,

yes, I did test the demo app and it gives the same result like in my app.
Also the 'LTHPasscodeViewController.sharedUser().view.layoutIfNeeded()' proposed from you didn't do the trick :(

@rolandleth
Copy link
Owner

Hey,

OK, can you provide a sample project based on the demo app, so I can try and debug it, please? Preferably a GitHub repo/fork with a new branch.

Thanks!

@6axter82
Copy link

6axter82 commented Aug 18, 2017

I guess you just use the demo project. and run it on the iPad , could also be a simulator (i get the bug on both).
Steps to reproduce after you run in the simulator or on an actual device:

  1. set the passcode
  2. go to change it, but don't do that and press cancel instead, it will bring you back to the initial view
  3. rotate device, go again to change the passcode
    Result: you will see the empty screen
  4. rotate the device or simulator again in the same view and everything comes to the place

@rolandleth
Copy link
Owner

Thanks! Will investigate today, hopefully.

@rolandleth
Copy link
Owner

Hey,

Added a fix in the latest commit, could you please have a look? Looks fine on my end, but I'd rather have another confirmation. Thanks!

@6axter82
Copy link

6axter82 commented Aug 21, 2017

Hey thank you very very much!

Works perfectly now. I tested only on the demo app from you, on simulator and an actual device.

Could it be your commit is there but it is not tagged? I run 'pod update' but no changes come from github. Can you add it to the next stable release such that it updates using Podfile.

@rolandleth
Copy link
Owner

I didn't update the pod just yet, I wanted to make sure everything is OK first. I will updated it later today. Thanks for confirming!

@6axter82
Copy link

@rolandleth hi, did you have a chance to update the pod?

@rolandleth
Copy link
Owner

Done.

@6axter82
Copy link

awesome, thank you very much again!

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

No branches or pull requests