Html 如何在 HTML5 中开发 iPhone 应用程序?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5662407/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I develop an iPhone app in HTML5?
提问by Chris
I have seen a blog which claims that we can develop iPhone applications in HTML5. Untill then I was aware about Objective-C on Mac.
我看过一个博客,声称我们可以用 HTML5 开发 iPhone 应用程序。直到那时我才知道 Mac 上的 Objective-C。
Can we develop an interface with backend support application in HTML5 on iPhone? Will it be secure and scalable?
我们可以在 iPhone 上用 HTML5 开发带有后端支持应用程序的接口吗?它会安全且可扩展吗?
If HTML5 is a markup language, then how can I make conditional statements in it? Would it be via jQuery or Javascript?
如果 HTML5 是一种标记语言,那么如何在其中进行条件语句?是通过 jQuery 还是 Javascript?
Which IDE should I use to develop an iPhone app in HTML5?
我应该使用哪个 IDE 来开发 HTML5 中的 iPhone 应用程序?
采纳答案by Marcel
A great place to start when developing an iPhone app in HTML5 is PhoneGap.
在 HTML5 中开发 iPhone 应用程序的一个很好的起点是PhoneGap。
You could either go the full-blown app route by developing an iOS app using PhoneGap, or only selecting certain tools/frameworksto help build a web-based app for mobile devices.
您可以通过使用 PhoneGap 开发 iOS 应用程序来走完整的应用程序路线,或者仅选择某些工具/框架来帮助为移动设备构建基于 Web 的应用程序。
And very much like how it works with websites, HTML is used for the structure, CSS for presentation and JavaScript for behaviour. So yes, JS is used for conditional statements, etc.
与网站的工作方式非常相似,HTML 用于结构,CSS 用于演示,JavaScript 用于行为。所以是的,JS 用于条件语句等。
回答by ATSiem
Yes.
是的。
You can develop an HTML5/CSS3/Javascript app, then wrap it in PhoneGapor Apache Cordovato make it native and put it in the App Store (or Android Market...), as well as publish it on the web. You can do this with whatever tools you're comfortable with.
您可以开发一个 HTML5/CSS3/Javascript 应用程序,然后将其包装在PhoneGap或Apache Cordova 中以使其成为本机并将其放入 App Store(或 Android Market...),以及将其发布到网络上。您可以使用任何您喜欢的工具来执行此操作。
Using a tool like PhoneGap has many benefits over browser-based Mobile Web Apps, such as allowing you to parse iPhone contacts and access the local hardware.
与基于浏览器的移动 Web 应用程序相比,使用 PhoneGap 之类的工具有很多好处,例如允许您解析 iPhone 联系人并访问本地硬件。
It's great in combination with jQuery Mobile, but since performance is a MAJOR issue you must be very cautious to really streamline your images, CSS, and Javascript.
它与jQuery Mobile结合使用非常好,但由于性能是一个主要问题,因此您必须非常谨慎地真正简化您的图像、CSS 和 Javascript。
See this linkto learn more about Mobile Frameworks.
请参阅此链接以了解有关移动框架的更多信息。
回答by Paul D. Waite
I have seen a blog which claims that we can develop iPhone applications in HTML5. Untill then I was aware about Objective-C on Mac.
我看过一个博客,声称我们可以用 HTML5 开发 iPhone 应用程序。直到那时我才知道 Mac 上的 Objective-C。
If you want to write a nativeiPhone application, then Objective-C is your only option. However, as the iPhone's web browser has a lot of capabilities (e.g. offline caching), you can develop applications that run in its web browser, as opposed to natively. They can't access all the features of the iPhone, and they are simply websites (so you need a server to serve them), but before the iPhone SDK was released, Steve Jobs himself described web apps as theway to write software for the iPhone.
如果您想编写本机iPhone 应用程序,那么 Objective-C 是您唯一的选择。但是,由于 iPhone 的网络浏览器具有很多功能(例如离线缓存),您可以开发在其网络浏览器中运行的应用程序,而不是在本机上运行。他们不可能全部访问iPhone的功能,它们只是网站(所以你需要一个服务器来为他们服务),但iPhone SDK发布之前,史蒂夫·乔布斯本人描述Web应用程序作为的方式来写软件的苹果手机。
Can we develop an interface with backend support application in HTML5 on iPhone? Will it be secure and scalable?
我们可以在 iPhone 上用 HTML5 开发带有后端支持应用程序的接口吗?它会安全且可扩展吗?
I have no idea what that means.
我不知道这意味着什么。
If HTML5 is a markup language, then how can I make conditional statements in it? Would it be via jQuery or Javascript?
如果 HTML5 是一种标记语言,那么如何在其中进行条件语句?是通过 jQuery 还是 Javascript?
Correct: JavaScript. (jQuery is just a JavaScript framework, and it's probably a bit heavy to use on current iPhones.)
正确:JavaScript。(jQuery 只是一个 JavaScript 框架,在当前的 iPhone 上使用它可能有点繁重。)
The HTML5 spec blurs the distinction between HTML and JavaScript by defining the DOM interface for the HTML elements it specifies, and defining new DOM features (e.g. offline caching) that aren't technically part of HTML. Apple (and other people) have further blurred the term “HTML5” by using it to encompass various CSS features like animations and transforms, which you'll probably find very useful for making web apps feel more like native apps.
HTML5 规范通过为它指定的 HTML 元素定义 DOM 接口,并定义技术上不属于 HTML 的新 DOM 功能(例如离线缓存),模糊了 HTML 和 JavaScript 之间的区别。Apple(和其他人)通过使用它来包含各种 CSS 功能(如动画和转换),进一步模糊了术语“HTML5”,您可能会发现这些功能对于使 Web 应用程序感觉更像本机应用程序非常有用。