I am trying to create a UIPickerView inside of a UIActionSheet with a "done" button in a bar on the action sheet above the picker and I am trying to display the action sheet from the tab bar.
here is the code I am using to create my picker:
_beepPicker = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 0, 320, 216)];
_beepPicker.showsSelectionIndicator = YES;
_beepPicker.dataSource = self;
_beepPicker.delegate = self;
here is the code I am using to create my action sheet (with my "done" button)
_beepPickerActionSheet = [[UIActionSheet alloc]
initWithTitle:nil
delegate:nil
cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:nil];
UISegmentedControl *doneButton = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:@"Done"]];
doneButton.momentary = YES;
doneButton.frame = CGRectMake(260, 7.0f, 50.0f, 30.0f);
doneButton.segmentedControlStyle = UISegmentedControlStyleBar;
doneButton.tintColor = [UIColor blackColor];
[doneButton addTarget:self action:@selector(dismissBeepPicker:) forControlEvents:UIControlEventValueChanged];
[_beepPickerActionSheet addSubview:doneButton];
and here is how I'm adding my "done" button:
[_beepPickerActionSheet addSubview:_beepPicker];
and finally, here is how I am trying to display the action sheet:
[_beepPickerActionSheet showFromTabBar:self.tabBarController.tabBar];
The Action Sheet does display... but, I can only see about 30 pixels of the top of the Action sheet????????
Any idea what I may be doing incorrectly?
When I check my debugger... here is what I see for the frame of the Action Sheet
UIActionSheet: 0x6b304f0; frame = (0 455; 320 25);
Screenshot before:
Screenshot after:
Ok... I know what I was doing incorrect... I had to add
[_beepPickerActionSheet setBounds:CGRectMake(0,0,320,485)];
After I added it to the view.