AKPickerView-Swift icon indicating copy to clipboard operation
AKPickerView-Swift copied to clipboard

Picker view not inside view constraints

Open corbrink opened this issue 8 years ago • 3 comments

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 avatar Mar 13 '16 07:03 corbrink

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.

corbrink avatar Mar 14 '16 12:03 corbrink

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!

Robertof avatar Nov 17 '16 00:11 Robertof

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.

terencepalmer avatar Apr 02 '17 19:04 terencepalmer