Take one UIView to name viewBack, as shown below.
@interface ViewController : UIViewController{ UIView *viewBack; }
in viewDidLoad: method simply defines this viewBackwith frame ie
- (void)viewDidLoad { viewBack = [[UIView alloc] initWithFrame:CGRectMake(95, 230, 130, 40)]; viewBack.backgroundColor = [UIColor blackColor]; viewBack.alpha = 0.7f; viewBack.layer.masksToBounds = NO; viewBack.layer.cornerRadius = 8; viewBack.hidden =YES; }
when you want to show the UIPickerView at that moment on this method, a screen similar to this will appear.
-(IBAction)btnPickerViewOpen_Clicked:(id)sender{ viewBack.hidden = NO; [self.view bringSubviewToFront:viewBack]; [self.view bringSubviewToFront:yourPickerView]; }
when you want to hide the UIPickerView at this time, use the following thread ...
-(IBAction)btnPickerViewClosed_Clicked:(id)sender{ viewBack.hidden = YES;
Hope this helps you ...
source share