什么是 PastryKit 框架?

我试图找到任何关于 PastryKit Javascript 框架的信息。它似乎是在 iPhone 用户指南中使用的,在 Mobile Safari 中显示在 iPhone 本身上,但我找不到任何文档或 API。如果你想看到它的运行状态,打开 Safari 4,将你的用户代理设置为 iPhone3(在开发菜单中) ,然后查看 向导

总的来说,它似乎是一种编写 HTML/CSS/Javascript 应用程序的方法,其行为类似于本地 iPhone 应用程序。

当涉及到 Javascript 时,我在 框架文件上使用了 JS 美容师(我假设是这样的) ,它超过了3,400行!经过优化,(再次假设)它的 实施n 超过了1200行。

在 CSS 方面,我在 框架 CSS上使用了 清洁 CSS(同样是我假设的那样) ,结果超过了700行。他们的执行不到500。

是否有人拥有或知道在哪里可以找到任何关于 PastryKit 的信息、文档或 API?或者,有人知道如何实现它吗?

25612 次浏览

It would appear that PastyKit is also in use in iTunes LP files. Fascinating. Can't wait to learn more about this — sorry not to have more details!

It looks like I'm doing the same research into how the guide works and found this page.

Apple's Dashcode product is supposed to generate web apps that looks like the iphone UI.. I don't know if that's where this code came from.

If you're looking to duplicate the UI for a web-app, check out jqTouch.

This Post was my first followed link on a Google inquiry.

You could simply grab the Stylesheets and JS files from the iPhone Guide and modify as needed. Everything is there - you'll just have to familiarize yourself with the code.

I'm kind of digging how it all works together as well. But I'd want to remove the call ups that force the redirect if it's not an iPhone (or a User Agent hasn't been changed).

Just implement some of it's functionality into a standard website - I love how it works in a desktop version of Safari.

John Gruber recently posted a link with some more information from his research over at Daring Fireball: pastrykit

EDIT: David Calhoun added a lot more in-depth information over at this blog: pastrykit digging into an apple pie

JQTouch needs you to learn some JQuery if you do not already knows it. iUI is also a pretty nice framework which is really HTML5 / CSS3 / Javascript only. See a demo here http://iui-js.appspot.com/ (runs on Safari, Chrome, and more or less on Firefox too)

A perennial problem with iPhone web development is disabling the vertical scrolling and bounce effects within a UIWebView. PastryKit can apparently disable this according to Wayne Pan. I haven't got it to work. You might be more competent.

digging into pastrykit

jqtouch also lets you disable vertical scrolling. Can't get it to work either.

turning off vertical scrolling

To find more info, a UML, Full Decoded/Decompressed Source and Assets check out this entry: apples pastry kit iphone javascript toolkit

we just also added a bunch of Info on AdLib (The iPad version of Pastry kit) AdLib iPad JS Framework

This contact list sample webapp works as well as native app. check this out: the article contact list on webkit for iphone

Been using http://webapp-net.com/ as a great framework for iphone web apps. Easy to use and stable...not as light as iui but easier and nicer presentation, Jq touch is heavy requiring JQuery. Did a bit of experimenting with all these frameworks before deciding to stick with webapp-net. There is also iWebkit but its not realy a webapp. More like native iPhone looking plain html.

In pursuance of PastryKit, I've discovered Sencha Touch. It's buttery smooth on the iPad. At this point in time, it is definitely more fluid than Apple's AdLib js lib (as used on the iPad User Guide site). Try their demoes on an actual iPad to have a real feel for the framework. It must be relatively new, because I find no mention of it among the other mobile JS libs.

Testing for "smoothness" on my iPad, it beats:

  • jQTouch
  • PastryKit/TuneKit/AdLib
  • WebApp.Net (mentioned in another post)

IMO, WebApp.Net is the next most native-like when it come to scrolling, clicking, sliding, etc. These are the most serious competitors I've tested.

Random sidenote: I'm a tad surprised Apple would name a mobile JS library PastryKit with Android's naming convention of desserts.

Update 10/3/2010: The relationship between Sencha Touch and jQTouch explained by their developer, Sencha.