横向和纵向上的UIActionSheet位置
问题描述:
当我以横向模式打开时,UIActionSheet定位不居中。如果我设置边界或更改框架。作为子视图的UIActionSheet内的内容会改变,但实际的工作表保持在看起来非常尴尬的相同位置。横向和纵向上的UIActionSheet位置
如何将UIActionSheet及其子视图移动到屏幕中央?
答
您可以使用以下代码,以便您可以将UIActionsheet放在屏幕中间。
UIActionSheet *actionsheet1 = [[UIActionSheet alloc]initWithTitle:@"Options" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Contacts", @"Employees",nil];
actionsheet1.tag = 1;
[actionsheet1 showInView:self.view];
[actionsheet1 setActionSheetStyle:UIActionSheetStyleBlackOpaque];
[actionsheet1 release];
请检查这段代码,如果您还有任何疑问,请让我知道。
我结束了使用UIAlertView添加我的内容作为警报视图的子视图。 – Dave 2010-04-01 00:23:33