一个故事板中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
最满意答案
您可以使用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 ...
-
记住$(this)是什么(remembering what $(this) is)[2024-05-05]
您可以使用jQuery的data()方法将信息与文档本身相关联,而不是全局变量: $(".objects_list").live('click', function(event) { $(this).css("color", "blue"); $(document).data("yourObjectKey", $(this)); }); 然后,您可以稍后轻松获取该信息: $("otherSelector").click(function() { var yourObject = $ ... -
记住搜索参数(Remembering search parameters)[2023-01-05]
在通用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哈希仍在地址栏中,您将能够获得该值。 然后使用该 ...