Uipicker Height

I am trying to change the height of pickerView. I would like it to show one line instead of five lines by default. help me plz

+3
source share
4 answers

Better you can use PickerView Frame like this,

    Pickerview.frame = CGRectMake(30,100,170,200);

alt text

+5
source

You can not. UIPickerViewcan display 5 lines or 3 lines, depending on the height of the frame that you pass to the method -setFrame:. When I need a short one UIPickerView, I will pass a height of 100. The code in UIKit will adjust this height as the closest possible value.

, . pickerView, , . , , . , 3 5 , 7 , iPhone.

, UIDatePicker . UIDatePickerModeCountDownTimer, .

+2

:

UIView 170 55.

subviews = YES

UIPickerView UIView. 0, -80.5.

UIImageView 170, 55 UIView. , .

transparent uipickerview frame

(You can resize the image and make it stretch to resize it horizontally)

The final result:

single row picker view

+2
source

Have you tried to implement numberOfRowsInComponent:? If this does not change the size, have you tried to set the selection frame?

ps: I agree with @Ritheesh @BoltClock, one line is not a good idea

-1
source

Source: https://habr.com/ru/post/1780855/


All Articles