arrteme
arrteme

Reputation: 393

UIActionSheet displays not from the bottom of the screen

I'm very new to iOS developing, so I got this problem and out of ideas of how to solve this.

Here's the idea: I have a single TableViewController in my app, and table consists of a few cells, where each includes an image, label and a button, and when you hit the button, the UIActionSheet creates and being displayed in the view.

So it seem to work and display just fine with portrait orientation, and for a first few cells in landscape orientation. But when I scroll a little down my table in landscape orientation, and hit the button, actionSheet never displays from the bottom of screen, how it was supposed to. Instead it shows somewhere above, in the middle of the screen or even on top. This happens only when I scroll my table down...

To show my actionSheet I use the following

[actionSheet showInView:self.view];

Here is what I keep on getting in iOS simulator:

enter image description here

Also, I am not using Interface Builder. I am also not using any Toolbars or TabBars, to view actionSheets from there.

Help!

Upvotes: 3

Views: 502

Answers (1)

user2545330
user2545330

Reputation: 408

Try it, I hope it will help!

UIWindow* window = [[[UIApplication sharedApplication] delegate] window];
if ([window.subviews containsObject:self.view]) 
{
    [actionSheet showInView:self.view];
} else 
{
    [actionSheet showInView:window];
}

Upvotes: 1

Related Questions