我有一个带有 tabbarcontroller 的应用程序,有两个 Controller ,现在在一个 Controller 中,我在纵向模型中显示了一个 uiactionsheet:
UIActionSheet *actionSheet = [[UIActionSheet 分配] 初始化标题:@“” 委托(delegate):无 cancelButtonTitle:@“取消” destructiveButtonTitle:@"删除" 其他按钮标题:无,无];
actionSheet.actionSheetStyle = UIActionSheetStyleBlackTranslucent;
[actionSheet showInView:self.view];
actionSheet.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleBottomMargin;
[actionSheet release];
我发现当我将模式更改为横向时,它不起作用,因为它不响应 Controller 委托(delegate):
-(void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
如果操作表不显示, Controller 可以更改为横向,为什么?非常感谢!!!
最佳答案
试试这个:
UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"Some text..."
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:@"Delete"
otherButtonTitles:@"Button 1",@"Button 2",nil];
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 3.0 ||
UIDeviceOrientationIsPortrait([[UIDevice currentDevice] orientation])) {
[sheet showInView:self.view];
} else {
[sheet showInView:self.view.window];
}
关于iphone - 为什么 UIActionSheet 不支持我的横向?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14742335/