Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>For getting the desired result which is shown in Above photo......i recomand you the Programing approach is better then the xib approch</p> <p>i think you a re trying to implement a picker action sheet with Done button. i will refer using segemnt control instead of using toolbar. </p> <p>Use this following code where you want to show action sheet with picker and Done button.</p> <pre><code>UIActionSheet *Example_Actionsheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil]; Ex_Picker = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 40, 0, 0)]; Ex_Picker.delegate = self; Ex_Picker.showsSelectionIndicator = YES; // note this is default to NO Example_Actionsheet.actionSheetStyle = UIActionSheetStyleBlackOpaque; [Example_Actionsheet addSubview:Bedroom_Picker]; [Example_Actionsheet showInView:self.view]; [Example_Actionsheet setBounds:CGRectMake(0, 0, 320, 485)]; UISegmentedControl *closeButton = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:@"Done"]]; closeButton.momentary = YES; closeButton.frame = CGRectMake(260, 7.0f, 50.0f, 30.0f); closeButton.segmentedControlStyle = UISegmentedControlStyleBar; closeButton.tintColor = [UIColor blueColor]; [closeButton addTarget:self action:@selector(Close_method) forControlEvents:UIControlEventValueChanged]; [Example_Actionsheet addSubview:closeButton]; [Example_Actionsheet release]; </code></pre> <p>and if you want to use Toolbar</p> <pre><code>pickerDateToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)]; pickerDateToolbar.barStyle = UIBarStyleBlackOpaque; [pickerDateToolbar sizeToFit]; NSMutableArray *barItems = [[NSMutableArray alloc] init]; UIBarButtonItem *flexSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil]; [barItems addObject:flexSpace]; UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(DatePickerDoneClick)]; [barItems addObject:doneBtn]; [pickerDateToolbar setItems:barItems animated:YES]; </code></pre> <p>And add the toolbar and picker in subview of actionsheet.</p> <pre><code>[aac addSubview:"Your toolbar"]; [aac addSubview:"Your picker"]; </code></pre> <p>and set the action sheet frame. its done with toolbar.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload