开发者

How to add custom toolbar to UIPickerView Control?

开发者 https://www.devze.com 2023-01-29 15:23 出处:网络
I want 开发者_Go百科to add a custom toolbar at the top of the UIPickerView control. I did this on Keyboard but not able to do with UIPickerView.

I want 开发者_Go百科to add a custom toolbar at the top of the UIPickerView control. I did this on Keyboard but not able to do with UIPickerView.

Nishant


make a toolBar by IBoutlet and set its y coordinate to 100 or more than view's height. then in particular action change y coordinate accordingly. this is done via animation.

You also use this with keyboard .

by using -(void) keyboardWillShow:(NSNotification *) note and -(void) keyboardWillHide:(NSNotification *) note


 UIToolBar *toolBar= [[UIToolbar alloc] initWithFrame:CGRectMake(0,0,320,44)];
        [toolBar setBarStyle:UIBarStyleBlackOpaque];
        UIBarButtonItem *barButtonDone = [[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStyleBordered target:self action:@selector(doneBtnTapped:)];

        toolBar.items = [[NSArray alloc] initWithObjects:barButtonDone,nil];
        barButtonDone.tintColor=[UIColor blackColor];
        [popoverView addSubview:toolBar];

        [popoverView addSubview:pickerView];


I created a custom view and added a done button on that along with picker view.

Thanks

0

精彩评论

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