开发者

UIActionSheet positioning issue within ScrollView

I'm trying to display an ActionSheet when a screen is touched within scrollview. The action sheet pops fine within the first page. But on subsequent pages the screen becomes dark and doesn't displaying anything, as if actual button is displaying on the off screen. I have tested different frame positioning of UIActionSheet but it does not seem to work.

self.view.frame.origin.x seems to have correct ScrollView position.

UIActionSheet *actionSheet = [[UIActionSheet alloc] 
                                  initWithTitle:nil 
                            开发者_JAVA百科      delegate:self 
                                  cancelButtonTitle:@"Cancel"
                                  destructiveButtonTitle:nil 
                                  otherButtonTitles:@"Jump to First Page", @"Browse Pages",nil];

CGRect frame = CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y, 480.0f, 320.0f);  
[actionSheet setFrame:frame];
[actionSheet showInView:self.view];


Assuming your UIScrollView is contained in the view of a UIViewController.

You should then display that UIActionSheet inside the root view of the view controller.


You are displaying it inside the scrollview, which will not work, because you are right, it is displayed off screen. you shouldn't display it inside the scrollview, rather, put the Scrollview in another view and display the ActionSheet inside that view.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜