2012-05-12 111 views
0

默认情况下,适用于iPhone的横向模式下的UIActionSheet采用屏幕宽度(480)。更改UIActionSheet宽度

我试图尽量减少宽度。我们如何改变宽度并且苹果是否会接受这种行为?

全码:

actionSheet = [[UIActionSheet alloc] initWithTitle:@"\n\n\n\n\n\n\n\n\n\n\n" delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil,nil]; actionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque; actionSheet.delegate = self; [actionSheet showInView:self.view]; [actionSheet setBounds:CGRectMake(0 , 0, 200, 320)]; 
+0

我尝试设置UIAction表单的边界。 [actionSheet setBounds:CGRectMake(0,0,200,320)]; – Bharathi

+0

actionSheet = [[UIActionSheet的alloc] initWithTitle:@ “\ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n” 个 委托:自 cancelButtonTitle:无 destructiveButtonTitle:无 otherButtonTitles:零,零]。 actionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque; actionSheet.delegate = self; [actionSheet showInView:self.view]; [actionSheet setBounds:CGRectMake(0,0,200,320)]; – Bharathi

+1

您必须阅读[this](http://stackoverflow.com/a/1860168/932011)您可以使用[UIView](https://github.com/homeyer/CustomUIActionSheet)使用uiactionsheet。您可以创建一个像动作表一样滑动的自定义视图 – akk

回答

1

,我不认为这种能力被内置到UIActionSheet因为我相信我还没有看到它在任何应用程序中实现。我会创建一个自定义UIView并使用UIViewAnimation从屏幕底部向上滑动它。如果您想阻止访问自定义操作表背后的视图,则需要创建一个视图,以便在主视图和自定义操作表之间进行切换,该操作表覆盖了屏幕的全部大小。