Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Marcio's excellent solution to this question was of great help to me in adding subviews of any kind to a UIActionSheet.</p> <p>For reasons that are not (yet) entirely clear to me, the bounds of the UIActionSheet can only be set after it has been displayed; both sagar's and marcio's solutions successfully address this with a setBounds:CGRectMake(...) message being sent to the actionsheet <strong>after</strong> it is shown.</p> <p>However, setting the UIActionSheet bounds after the sheet has been displayed creates a jumpy transition when the ActionSheet appeaars, where it "pops" into view, and then only scrolls in over the final 40 pixels or so.</p> <p>When sizing a UIPickerView after adding subviews, I recommend wrapping the setBounds message sent to the actionSheet inside an animation block. This will make the entrance of the actionSheet appear smoother.</p> <pre><code>UIActionSheet *actionSheet = [[[UIActionSheet alloc] initWithTitle:nil delegate:nil cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil]; // add one or more subviews to the UIActionSheet // this could be a UIPickerView, or UISegmentedControl buttons, or any other // UIView. Here, let's just assume it's already set up and is called // (UIView *)mySubView [actionSheet addSubview:myView]; // show the actionSheet [actionSheet showInView:[UIApplication mainWindow]]; // Size the actionSheet with smooth animation [UIView beginAnimations:nil context:nil]; [actionSheet setBounds:CGRectMake(0, 0, 320, 485)]; [UIView commitAnimations]; </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. 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