ios - How to customise the UIPickerView height -
how customise height of uipickerview more 250 . have done following unable height given
-(void)pickerview:(id)sender { pickerview=[[uipickerview alloc] initwithframe:cgrectmake(0,200,320,400)]; pickerview.transform = cgaffinetransformmakescale(0.75f, 0.75f); pickerview.delegate = self; pickerview.datasource = self; pickerview.showsselectionindicator = yes; pickerview.backgroundcolor = [uicolor lightgraycolor]; [pickerview selectrow:1 incomponent:0 animated:yes]; [self.view addsubview:pickerview]; // [contentview addsubview:pickerview]; }
here there 3 valid heights uipickerview (162.0, 180.0 , 216.0).
you can use cgaffinetransformmaketranslation , cgaffinetransformmakescale functions fit picker convenience.
example:
cgaffinetransform t0 = cgaffinetransformmaketranslation( 0, pickerview.bounds.size.height/2 ); cgaffinetransform s0 = cgaffinetransformmakescale(1.0, 0.5); cgaffinetransform t1 = cgaffinetransformmaketranslation( 0, pickerview.bounds.size.height/-2 ); pickerview.transform = cgaffinetransformconcat( t0, cgaffinetransformconcat(s0, t1) );
the above code change height of picker view half , re-position exact (left-x1, top-y1) position.
refer more here. how change uipickerview height