【问题标题】:Popover / ActionSheet styling to match system apps?Popover / ActionSheet 样式以匹配系统应用程序?
【发布时间】:2011-07-22 09:16:10
【问题描述】:

我希望有人可以帮助我...我想在我正在开发的 iPad 应用程序中使用弹出框(或显示为弹出框的操作表)。

我遇到的问题是让它们看起来像我想要的那样。我希望我的弹出框看起来像许多核心应用程序中使用的标准弹出框。

当您进入作为拆分视图一部分的弹出框或“打印机选项”弹出框时,我在背景渐变上出现白色标题时遇到了特殊问题。

有没有办法做到这一点?

【问题讨论】:

    标签: ios ipad uipopovercontroller look-and-feel


    【解决方案1】:

    在弹出窗口中显示操作表的标准方法如下:

    -(IBAction)moreActions:(UIBarButtonItem *)it{
        UIActionSheet *act = [[UIActionSheet alloc] initWithTitle:@"What should we do?" 
                                                         delegate:self 
                                                cancelButtonTitle:nil 
                                           destructiveButtonTitle:nil 
                                                otherButtonTitles:@"Render Video (again)",@"Share Story",@"Email Story",@"YouTube",@"Save to Library",nil];
    
        act.actionSheetStyle = UIActionSheetStyleBlackTranslucent;
        [act showFromBarButtonItem:it animated:YES];
        [act release];
    }
    

    这将在 it UIBarButtonItem 的弹出框内显示 UIActionSheet。这看起来与核心应用程序中的完全一样。如果您不是从 UIBarButtonItem 呈现,请使用 - (void)showFromRect:(CGRect)rect inView:(UIView *)view animated:(BOOL)animated 方法从任意帧呈现。

    这是你在做什么?

    【讨论】:

    • 是的,这就是我要去的地方。不幸的是,标题显得非常小而且灰色(与系统应用程序相比),当我真的想要标签、文本字段和文本视图的混合时,我仅限于使用按钮进行控件。
    • 你能张贴一张不同的图片吗?
    • 我的意思是,当然对于其他 UI 元素,您需要构建自定义视图。但是图形上的区别是什么?
    • 我应该能够...The different appearances of the titles(左侧是 ActionSheet,右侧是来自系统弹出框的相同文本 - 均来自模拟器)
    • 我也不确定我们是否可以在 UIActionSheet 中拥有自定义视图。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-28
    • 2018-08-21
    相关资源
    最近更新 更多