Search code examples
objective-ciosxcodeuiviewuiactionsheet

Adding UIView to UIActionSheet size not right


I am trying to add a view into an ActionSheet, but the dimensions are all messed up.

The view shows up, but when it doesn't show up with the correct size. I made the View Width 300 by Height 411.

When I add it to the actionsheet using the code:

ContactCardViewController* myController = [[ContactCardViewController alloc] initWithNibAndEmployeeInfo:[self.request objectForKey:@"Requestor"]];

[self.actionSheet showInView:self.view];
[self.actionSheet setBounds:[myController.view frame]];
[self.actionSheet addSubview:myController.view];

Only about half the View shows and the right is slightly cut off, and it seems like it's almost the same size as the superview, which it should be a lot smaller.

How do I fix this?

Thanks!


Solution

  • You should not change bounds, frame or center and add or modify subviews of UIActionSheet.

    That is how you can fix that, because nobody knows internal implementation of this class and it definitely does not behave as normal UIView.