首页 \ 问答 \ 一个故事板中iPhone和iPad的不同方向(Different orientation for iPhone and iPad in one storyboard)

一个故事板中iPhone和iPad的不同方向(Different orientation for iPhone and iPad in one storyboard)

我正在开发一个iOS应用程序,它实际上是现有Web应用程序的包装器。 它增加了一些只能通过这种方式实现的附加功能。

我使用大小类和布局约束完成了应用程序的设计。 我在iPhone和iPad上都使用了一个故事板。 问题是,我希望iPhone应用程序只能使用纵向模式,而iPad可能只使用横向模式(有针对iPhone和iPad优化的不同Web应用程序)。

是否可以仅使用一个故事板来完成此操作,或者我是否需要使用两个故事板(一个用于iPhone,设置为仅纵向;一个用于iPad,仅设置为风景); 因此重复我的设计?


I'm developing an iOS application, which is actually a wrapper for an existing web application. It adds some additional functionality which can only be achieved this way.

I finished designing the application using size classes and layout constraints. I used one storyboard for both iPhone and iPad. The problem is, I want the iPhone application to be able to only use portrait mode, while the iPad may only use landscape mode (there are different web applications optimized for iPhone and iPad).

Is it possible to do this using only one storyboard, or do I need to use two storyboards (one for iPhone, set to only portrait; and one for iPad, set to only landscape); hence duplicating my design?


原文:https://stackoverflow.com/questions/27589641
更新时间:2022-09-07 15:09

最满意答案

您可以使用jQuery的data()方法将信息与文档本身相关联,而不是全局变量:

$(".objects_list").live('click', function(event) {
    $(this).css("color", "blue");
    $(document).data("yourObjectKey", $(this));
});

然后,您可以稍后轻松获取该信息:

$("otherSelector").click(function() {
    var yourObject = $(document).data("yourObjectKey");
    if (yourObject != null) {
        yourObject.css("color", "red");
    }
});

编辑:如果元素被销毁并在两个事件之间重新创建,该方法将无法工作。 在这种情况下,您可以存储元素的id而不是对元素本身的引用:

$(".objects_list").live('click', function(event) {
    $(this).css("color", "blue");
    $(document).data("yourObjectKey", this.id);
});

然后:

$("otherSelector").click(function() {
    var yourObjectId = $(document).data("yourObjectKey");
    if (yourObjectId != null) {
        $("#" + yourObjectId).css("color", "red");
    }
});

Instead of a global variable, you can use jQuery's data() method to associate information with the document itself:

$(".objects_list").live('click', function(event) {
    $(this).css("color", "blue");
    $(document).data("yourObjectKey", $(this));
});

Then you can easily get that information later:

$("otherSelector").click(function() {
    var yourObject = $(document).data("yourObjectKey");
    if (yourObject != null) {
        yourObject.css("color", "red");
    }
});

EDIT: If the element is destroyed and recreated between the two events, that method won't work. In that case, you can store the element's id instead of a reference to the element itself:

$(".objects_list").live('click', function(event) {
    $(this).css("color", "blue");
    $(document).data("yourObjectKey", this.id);
});

Then:

$("otherSelector").click(function() {
    var yourObjectId = $(document).data("yourObjectKey");
    if (yourObjectId != null) {
        $("#" + yourObjectId).css("color", "red");
    }
});

相关问答

更多
  • 处理SelectionChanged事件时,可以将SelectedItem (我假设您已经检索以确定新页面)保存到页面属性。 然后,在页面的OnNavigatedTo事件中,如果该项目不为null,则可以使用ScrollTo方法。 像这样的东西(其中lls是你的longlistselector): private object previousItem = null; private void lls_SelectionChanged(object sender, SelectionChangedEvent ...
  • 我无法破译你的设置,但你可以启用登录管理器调试并检查Firefox的功能。 您还可以检查配置文件中的 signons.sqlite,以查看登录时存储了哪些数据。 我认为对于网页表单来说,它关闭了表单的提交网址,但是我的记忆对此很隐晦。 source(nsLoginManager.js)表示它只使用表单的action和页面的URL,它不使用动作/页面URL本身,但是(请参阅_getPasswordOrigin )scheme + host +端口组合。 I couldn't quite decipher wh ...
  • 使用preservedRouteParameters ,它检索的值的来源是当前请求 。 因此,如果您希望浏览层次结构,则不能将id用于其他目的。 此外,您必须确保所有祖先preservedRouteParameters都包含在当前请求中,否则URL将无法正确构建。 有一个演示如何在这里使用preservedRouteParameters : https : //github.com/NightOwl888/MvcSiteMapProvider-Remember-User-Position 。 I solve ...
  • 当用户转到ProtectedPage.php而未经过认证时,它应该自动将它们重定向到LoginView.php (连同上一页的URL)。 然后他们可以继续登录, LoginAction.php页面将重定向到ProtectedPage.php ProtectedPage.php LoginView. ...
  • 假设您正在呈现HTML而不是JSON(看起来您来自标记),为什么不将请求中的过滤器查询参数添加到呈现的页面中? 例如,像这样: 蟒蛇: @app.route('/search') def search(): page_no = request.args.get('page_no') color = request.args.get('color') brand = request.args.get('brand') # TODO: Generate your results ...
  • inject / reduce只不过是左边的折叠 (因此在其他语言中称为foldl / foldLeft ),就是它,元素与二元运算符的递归左关联组合: (1..5).reduce(:+) == (((1 + 2) + 3) + 4) + 5 #=> true (1..5).reduce(:-) == (((1 - 2) - 3) - 4) - 5 #=> true 所以累加器作为块的左/第一个参数传递是很自然的。 在右边的fold中,累加器就是右/第二个参数。 不是一个真正的助记符,但是一旦你意识到re ...
  • 您可以使用jQuery的data()方法将信息与文档本身相关联,而不是全局变量: $(".objects_list").live('click', function(event) { $(this).css("color", "blue"); $(document).data("yourObjectKey", $(this)); }); 然后,您可以稍后轻松获取该信息: $("otherSelector").click(function() { var yourObject = $ ...
  • 在通用JavaScript文件中添加以下代码。 在搜索页面以外的所有页面上引用此文件: sessionStorage.removeItem('selectedCompanies'); sessionStorage.removeItem('selectedCategories'); sessionStorage.removeItem('searchWord'); 这将清除所有其他页面上的搜索参数,但允许数据在搜索页面上保留。 Add the following code in a common JavaSc ...
  • 无需使用会话或获取变量,只需从登录页面上的$ _SERVER数组访问HTTP_REFERER,将其设置为表单中的隐藏元素,然后在提交后重定向回该URI No need to use sessions or get variables, simply access the HTTP_REFERER from the $_SERVER array on your login page, set it to a hidden element in your form then after submission r ...
  • 您可以使单击的链接/元素(对于onclick事件)在地址栏中设置URL哈希。 (即http://server.name/page#URLhash )如果它是一个链接,你只需调整HREF属性,否则你可能不得不使用window.location进行操作。 这设置了当前状态。 页面(重新)加载时,检查URL哈希的值。 有关如何访问它的详细信息,请参阅http://developer.mozilla.org/en/DOM/window.location 。 如果URL哈希仍在地址栏中,您将能够获得该值。 然后使用该 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)