我有这样的代码从NSMutableArray的NSDictionary中获取NSString,但问题是它没有显示正确。 下面是代码:ActionSheet没有正确显示
UIActionSheet *playingSheet = [[UIActionSheet alloc] initWithTitle:@"Hi" delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil];
for(NSDictionary *dict in accounts) {
NSString *name = [dict objectForKey:@"Name"];
[playingSheet addButtonWithTitle:name];
}
[playingSheet showInView:self.view];
[playingSheet release];
的问题是在我的情况,self.view是parentView的子视图,并从厦门国际银行加载且无法全屏显示。所以问题是我的操作表就像iPhone屏幕宽度的一半,甚至不能触摸屏幕的底部。 在我的情况下,我如何修复它,使其最上面的视图(以便用户可以正确看到它),以及常规actionSheet应该看起来的方式?
谢谢!
编辑:这是修复:
[playingSheet showInView:[UIApplication sharedApplication].keyWindow];
不确定如果每次按钮的数量发生变化,我将如何设置操作页的高度。 –
修正了它: [playingSheet showInView:[UIApplication sharedApplication] .keyWindow]; –
不错...我不知道这种方式!无论如何,你可以使“yourDesiredHeight”随着按钮的数量而变化,其中每个按钮增加一个特定的数量给“yourDesiredHeight”。与“theHeightYouWant”类似。 – tipycalFlow