【问题标题】:Can I add an iPad popover programatically?我可以以编程方式添加 iPad 弹出框吗?
【发布时间】:2010-08-17 07:02:49
【问题描述】:

是否可以在不使用 NIB 文件的情况下以编程方式添加弹出框?我遇到的所有示例都使用 NIB 文件。

任何信息/帮助/示例将不胜感激。

谢谢!

【问题讨论】:

    标签: objective-c cocoa-touch uikit ipad


    【解决方案1】:

    看看UIPopoverController。 使用内容视图控制器(显示您的内容的任何 UIViewController 子类)初始化它,然后您可以使用以下命令显示它:

    - (void)presentPopoverFromRect:(CGRect)rect inView:(UIView *)view permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated
    

    - (void)presentPopoverFromBarButtonItem:(UIBarButtonItem *)item permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated
    

    【讨论】:

    • 感谢 V1ru8!完美运行 - 非常感谢。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-03
    相关资源
    最近更新 更多