tailieunhanh - Lập trình iPhone part 6
cho đến thời điểm này, chúng tôi đã viết các ứng dụng với một bộ điều khiển xem duy nhất. Trong khi có chắc chắn là rất nhiều bạn có thể làm với một cái nhìn duy nhất, quyền lực thực sự của nền tảng iphone hiện ra khi khi bạn có thể chuyển đổi ra xem dựa trên người dùng nhập vào. ứng dụng MultiView mang đến nhiều điều khác nhau, nhưng cơ chế cơ bản là như nhau, bất kể nó như thế nào có thể xuất hiện trên màn hình | Multiview Applications p until this point we ve written applications with a single view controller. While there certainly is a lot you can do with a single view the real power of the iPhone platform emerges when you can switch out views based on user input. Multiview applications come in several different flavors but the underlying mechanism is the same regardless of how it may appear on the screen. Strictly speaking we have worked with multiple views in our previous applications since buttons labels and other controls are all subclasses of UlView and can all go into the view hierarchy. But when Apple uses the term view in documentation it is generally referring to a subclass of UlView that has a corresponding view controller. These types of views are also sometimes referred to as content views because they are the primary container for the content of our application. 113 114 CHAPTER 6 Multiview Applications The simplest example of a multiview application is a utility application. A utility application focuses primarily on a single view but offers a second view that can be used to configure the application or to provide more detail than the primary view. The Stocks application that ships with iPhone is a good example see Figure 6-1 . If you click the little icon in the lower right corner the view flips over to let you configure the list of stocks tracked by the application. There are also several tab bar applications that ship with the iPhone such as the Phone application see Figure 6-2 and the Clock application. A tab bar application is a multiview application that displays a row of buttons at the bottom of the screen. Tapping one of the buttons causes a new view controller to become active and a new view to be shown. In the Phone application for example tapping Contacts shows a different view than the one shown when you tap Keypad. NOTE__ Tab bars and toolbars can be confusing. A tab bar .
đang nạp các trang xem trước