akkyie/AKPickerView

Height of interactive region does not match height of the picker view

Closed this issue · 2 comments

With the current implementation, the interactive region of the picker view is limited to the height of labels contained in the picker view (and these labels are sized to fit the specified titles). This can make it difficult to interact with the picker view in some cases, in particular for smaller fonts.

To observe this issue, the sample picker view app can be modified as follows:

diff --git a/AKPickerViewSample/AKViewController.m
--- a/AKPickerViewSample/AKViewController.m
+++ b/AKPickerViewSample/AKViewController.m
@@ -21,7 +21,8 @@

 {
     [super viewDidLoad];

-       self.pickerView = [[AKPickerView alloc] initWithFrame:self.view.bounds];
+       self.pickerView = [[AKPickerView alloc] initWithFrame:CGRectInset(self.view.bounds, 0, self.view.bounds.size.height/ 2.5)];
+       self.pickerView.backgroundColor = [UIColor redColor];

To address this issue, one solution would be to modify the interactive region to be the full height of the picker view. After making the change, the picker view background will be red but interaction will be limited only to the region of the screen containing the labels.

Finally fixed it (f2cc92c).
This problem was caused by making collection view fitted to text height. Now the size of collection view equals to AKPickerView's bounds so you can scroll from anywhere on it.
I greatly appreciate your re-contribution!

@akkyie Thank you for fixing!