【问题标题】:Ipad/iphone..action sheetIpad/iphone..action sheet
【发布时间】:2011-04-05 19:05:48
【问题描述】:

我使用带有操作表的选择器视图和日期选择器,它在 iphone 中运行良好。 我为 ipad 升级了我的 iphone 应用程序。我设置了操作表 autoresize 属性,但它没有显示在 ipad 中,当我旋转 iphone 时。这是我的代码

UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Select Payment Type"
                                                      delegate:self
                                             cancelButtonTitle:@"Done"
                                        destructiveButtonTitle:@"Cancel"
                                             otherButtonTitles:nil];


// Add the picker
picker = [[UIPickerView alloc] initWithFrame:CGRectMake(0,185,0,0)];

picker.delegate = self;
picker.showsSelectionIndicator = YES;    // note this is default to NO
picker.autoresizingMask=UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
[actionSheet addSubview:picker];
[actionSheet showInView:self.view];
[actionSheet setBounds:CGRectMake(0,0,320, 700)];
actionSheet.autoresizingMask=UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleTopMargin
|UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleBottomMargin;
[picker release];
[actionSheet release];

【问题讨论】:

    标签: iphone objective-c ios ipad uiactionsheet


    【解决方案1】:

    在 iPad 中使用 Actionsheet 需要牢记的一点是,它显示为 PopOver ViewController。这是 iPad 中 Action Sheet 的默认行为。

    干杯

    【讨论】:

    • 那么如何在 ipad 和 iphone 中使用相同的??
    • 如果你想在iPad上使用,你需要使用和popover Viewcontroller一样的代码
    • 好吧,你的意思是我必须使用可以在 iphone 上工作的弹出视图控制器?我不想为 ipad 和 iphone 编写不同的代码。
    • 我建议为 iPad 和 iPhone 编写不同的代码。它只是让它成为一种更清洁的体验。您将所有数学/逻辑/网络/解析都放在一个单独的类框架中,然后从 iPad/iPhone 视图控制器中调用它们。好多了。
    猜你喜欢
    • 1970-01-01
    • 2021-08-20
    • 1970-01-01
    • 1970-01-01
    • 2015-11-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多