Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

Picker view not inside view constraints #45

Open
corbrink opened this issue Mar 13, 2016 · 3 comments
Open

Picker view not inside view constraints #45

corbrink opened this issue Mar 13, 2016 · 3 comments

Comments

@corbrink
Copy link

grab

Hi,
I've been trying to resize the picker view so that the items are displayed inside the view.

In my storyboard I added a View, 100 x 40, and referenced it to AKPickerView. However when I run the code there is nothing inside the view. When I make the view bigger and run it the items are visible inside the bigger view.
The little rectangle right of 4 is an imageView which seems the lower the last value so that it is not in line with the rest. Is there a way to remove this?

How do I change the code to ensure that the items are displayed in the smaller View?

@corbrink
Copy link
Author

I'll answer this myself after I read #20. I also had the picker view in a navigation controller. After disabling the top bar in the view, not navC, the problem was resolved and the picker displays correctly.
This is however an issue that I think needs to be resolved. Great code by the way, thanks!

Akkyie you can close if you want.

@Robertof
Copy link

Just a heads up: I faced the same issue, and hiding the top bar didn't help.

Here's what I did that fixed it:

picker.superview?.bringSubview (toFront: picker)

This is Swift 3, BTW. And it works like a charm!

@terencepalmer
Copy link

This seems to be caused by UICollectionView. AKPickerView works great for me in one view that is not embedded in a navigation controller, but the labels are not visible when it is embedded in a navigation controller. Robertof's solution did not work for me. Disabling the navigation bar doesn't seem like a good solution, because I want the navigation bar. What does work for me is putting either:

self.automaticallyAdjustsScrollViewInsets = false

Or:

navigationController?.navigationBar.isTranslucent = false

in my ViewController.

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

3 participants