UIPickerView row height change

I am working on a program for the class that I take, and part of the program requires a UIPickerView with images in it. I have a collector and it works, but the height of the lines in the collector is still too small, which leads to overlapping images (100x100). I am looking for a way to change the UIPickerView so that the images fit on one line without overlapping. Thanks

+8
ios objective-c cocoa-touch uipickerview
source share
2 answers

In the documentation for UIPickerView you have a link to UIPickerViewDelegate . There is a way you can implement pickerView:rowHeightForComponent:

+20
source share

use this method, specify the default value as the delegation method.

objective-C

 - (CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent:(NSInteger)component { return 40; } 

In Swift:

 func pickerView(pickerView: UIPickerView, rowHeightForComponent component: Int) -> CGFloat { return 40 } 
+8
source share

All Articles