tailieunhanh - Lập trình ứng dụng cho iPhone part 6

Using Canvas for web apps Chúng ta đã thảo luận hai cách chính để bố trí iPhone có chất lượng cao ứng dụng web. Như chúng tôi mô tả trong chương 4, bạn có thể tạo ứng dụng chủ yếu dựa trên văn bản có sử dụng HTML mở rộng mới của WebKit. Ngoài ra, bạn có thể sử dụng một thư viện của bên thứ ba như IUI để tạo ra các trang web trông rất giống các ứng dụng iPhone bản địa, như chúng tôi đã chỉ ra trong chương 5 | Using Canvas for web apps This chapter covers Learning about Canvas Using Canvas to draw simple shapes Using Canvas for animations and other complex graphics We ve already discussed two major ways to lay out high-quality iPhone web apps. As we described in chapter 4 you can create primarily text-based applications that use the new HTML extensions of the WebKit. Alternatively you can use a third-party library like iUI to create web pages that look a lot like iPhone native apps as we showed in chapter 5. But what if you want to create graphical web apps for the iPhone mirroring items like Clock Stocks and Weather At first this might seem a little daunting because we ve already learned that we can t use either Flash or SVG on the iPhone. Fortunately Apple has a ready-made answer Canvas. Canvas is a scalable vector graphics toolkit implemented as an HTML tag with limited animation functionality accessible through JavaScript that was created by 102 Getting ready for Canvas 103 Apple. It was originally created to build the Mac OS X dashboard utilities but Canvas soon afterward made it into the WebKit and thus into Safari . Apple has continued to support Canvas notjust in mobile Safari but also generally on the iPhone. The aforementioned Clock Stocks and Weather utilities were all built using Canvas native to the iPhone so it will be very simple for you to mimic the same functionality when you re using Canvas on your web pages you ll be using the exact same tools as the widget designers for the iPhone. Getting ready for Canvas Using Canvas on your iPhone is simplicity itself. There s nothing to download and no libraries to link in it s already part of the WebKit as we learned in chapter 4. You just need to use Canvas-related markup and commands which will then be correctly interpreted by any Canvas-compliant browser. In this section we re going to look at how to enable Canvas and maintain compatibility with other browsers at the same time and then we re going put it .

crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.