Please find the below code i tried to add toolbar into the uipicker but it is not working
Pls let me know
UIPickerView *pickerViewCountry = [[UIPickerView alloc] init];
pickerViewCountry.showsSelectionIndicator = YES;
pickerViewCountry.dataSource = self;
pickerViewCountry.delegate = self;
pickerViewCountry.autoresizingMask = (UIViewAutoresizingFlexibleWidth |
UIViewAutoresizingFlexibleHeight);
[pickerViewCountry sizeToFit];
pickerViewCountry.frame = CGRectMake(0,210 , 320, 15);
[self.view addSubview:pickerViewCountry];
//[pickerViewCountry release];
UIToolbar *toolbar = [[UIToolbar alloc] init];
toolbar.frame = CGRectMake(10,200, 320, 44);
toolbar.barStyle = UIBarStyleBlackTranslucent;
[pickerViewCountry addSubview:toolbar];
[toolbar release];
When you call:
toolbar.frame = CGRectMake(10,200, 320, 44);
The CGRect is relative to the picker view (if you addSubview to pickerViewCountry), so the placement would not align at the top of the picker view, but rather somewhere in the lower right corner outside of the picker view, so it wouldn't display.
What are you trying to accomplish? You might not want to add a UIToolbar to a UIPickerView. You could instead try adding the UIToolbar to the main view.
[self.view addSubview: toolbar];
and keep toolbar.frame = CGRectMake(10,200, 320, 44);
as it is.