TAILIEUCHUNG - Lập trình iPhone part 5

Iphone là một mảnh tuyệt vời của kỹ thuật. Apple kỹ sư tìm thấy tất cả các loại cách để squeeze chức năng tối đa thành một bộ túi cỡ. Một ví dụ là cơ chế cho phép các ứng dụng được sử dụng trong hai gương điển hình (cao và gầy) hoặc landcape (ngắn và rộng) Hình thức và thay đổi điều đó định hướng trong thời gian chạy nếu điện thoại xoay. Một ví dụ điển hình của hành vi này, đó là autorotation gọi là, có thể được nhìn thấy trong trình duyệt web của iPhone, Mobile. | I Cha Autorotation and Autosizing he iPhone is an amazing piece of engineering. Apple engineers found all kinds of ways to squeeze maximum functionality into a pocket-sized package. One example is the mechanism that allows applications to be used in either portrait tall and skinny or landscape short and wide mode and to change that orientation at runtime if the phone is rotated. A prime example of this behavior which is called autorotation can be seen in iPhone s web browser Mobile Safari see Figure 5-1 . Figure 5-1. Like many iPhone applications Mobile Safari changes its display based on how it is held making the most of the available screen space. 89 90 CHAPTER 5 Autorotation and Autosizing Autorotation might not be right for every application. Several of Apple s iPhone applications support only a single orientation. Movies can only be watched in landscape mode for example and contacts can only be edited in portrait mode. Bottom line if autorotation enhances the user experience add it to your application. Fortunately Apple did a great job of hiding the complexities of autorotation in the iPhone OS and in the UlKit so implementing this behavior in your own iPhone applications is actually quite easy. Autorotation is specified in the view controller so if the user rotates the phone the view controller will be asked if it s OK to rotate to the new orientation something you ll see how to do in this chapter . If the view controller responds in the affirmative the application s window and views will be rotated and the window and view will get resized to fit the new orientation. A view that starts in portrait mode will be 320 pixels wide and 460 pixels tall or 480 pixels tall if there s no status bar. The status bar is the 20-pixel strip at the top of the screen see Figure 5-1 that shows things like signal strength time and battery charge. When the phone is switched to landscape mode the view rotates along with the application s window and gets resized to fit the new .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.