开发者

Changing UIPickerView row height

开发者 https://www.devze.com 2023-03-14 01:31 出处:网络
I\'m working on a program for a class I\'m taking and part of the program requires a UIPickerView with images in it. I have the picker up and running, but the height of the rows in the picker are stil

I'm working on a program for a class I'm taking and part of the program requires a UIPickerView with images in it. I have the picker up and running, but the height of the rows in the picker are still too small, causing the images (100x100) to overlap. I'm looking for a way to change the UIPickerView so th开发者_JS百科at the images will fit in one row, without overlapping. Thanks


In the documentation for the UIPickerView, you have a link to the UIPickerViewDelegate protocol. There is a method that you can implement, pickerView:rowHeightForComponent:.


use this method,provide default as a delegete method.

objective-C

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

In Swift:

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

for more visit : real world implementation

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号