简体   繁体   English

iPhone-没有视图控制器的应用程序中的“后退”按钮

[英]iphone - Back button in an app without view controller

I'm completely new to iphone apps. 我是iPhone应用程序的新手。 I'm creating an iphone app that is designed in HTML and jquery with phonegap. 我正在创建一个使用phonegap以HTML和jquery设计的iPhone应用程序。 I want to include a back button on the top like the default one in the iphone. 我想在顶部像iPhone中的默认按钮一样包含一个后退按钮。 I searched on net but all i found, required view controllers.I don't have multiple views so how can i include a back button on my app. 我在网上搜索,但是找到了所有需要的视图控制器。我没有多个视图,所以我该如何在我的应用程序中包含一个后退按钮。 Step by step explanation would be very helpful. 逐步解释将非常有帮助。

Thanks in advance..:) 提前致谢..:)

Why would you include a "back" button if you don't have multiple views? 如果您没有多个视图,为什么还要包含“后退”按钮? What exactly will you navigate "back" to? 您究竟将导航“返回”到什么位置?

"The net" is correct, you need a UINavigationController to house a "back" button which would pop a view to the previous view. “网络”是正确的,您需要一个UINavigationController来容纳一个“后退”按钮,该按钮会将视图弹出到上一个视图。

Other than a UINavigationController, you could use a UIToolbar and set a button to the left hand corner and give it the title of "Back" to simulate the native appearance — but this would be misleading and pointless. 除了UINavigationController之外,您还可以使用UIToolbar并在左上角设置一个按钮,并为其指定标题“ Back”以模拟本机外观,但这会产生误导且毫无意义。

I don't use PhoneGap, but I am sure there is a way to simulate a NavigationController and manually place a button there. 我不使用PhoneGap,但是我敢肯定有一种方法可以模拟NavigationController并在其中手动放置一个按钮。 I'm also sure it won't be shaped like a back button either (with the pointy end). 我也确定它的形状也不会像后退按钮(尖端)。

javascript:history.go(-1)

UINavigationController is a native control which is in iOS frameworks. UINavigationController是iOS框架中的本机控件。 As you are using HTML, jQueryMobile and phonegap you should not be looking at those controls. 当您使用HTML,jQueryMobile和phonegap时,不应查看这些控件。 You should totally work in your HTML pages and CSS for that purpose. 为此,您应该完全在HTML页面和CSS中工作。

The below page contains that back button in jquery mobile. 下页包含jquery mobile中的后退按钮。 You should be implementing this in your html page. 您应该在html页面中实现它。

http://jquerymobile.com/test/docs/toolbars/docs-headers.html http://jquerymobile.com/test/docs/toolbars/docs-headers.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM