TAILIEUCHUNG - Lập trình iPhone part 3

Xử lý tương tác cơ bản "Hello của chúng tôi, thế giới!" Ứng dụng được tốt giới thiệu về iphone phát triển bằng cách sử dụng Cocoa Touch, nhưng nó đã mất tích một khả năng rất quan trọng: khả năng giao diện với người dùng. Nếu không có điều đó, ứng dụng của chúng tôi bị hạn chế trong các mục của những gì nó có thể thực hiện | Ch Handling Basic Interaction ur Hello World application was a good introduction to iPhone development using Cocoa Touch but it was missing a crucial capability the ability to interact with the user. Without that our application is severely limited in terms of what it can accomplish. In this chapter we re going to write a slightly more complex application one with two buttons as well as a label see Figure 3-1 . When the user taps either of the buttons the label s text changes. This may seem like a rather simplistic example but it demonstrates the key concepts you ll need to master the use of controls in your iPhone applications. Figure 3-1. The simple two-button application we will be building in this chapter 29 CHAPTER 3 Handling Basic Interaction The Model-View-Controller Paradigm Before diving in a tiny bit of theory is in order. The designers of Cocoa Touch were guided by a concept called Model-View-Controller or MVC which is a very logical way of dividing up the code that makes up a GUI-based days almost all object-oriented frameworks pay a certain amount of homage to MVC but few are as true to the MVC model as Cocoa Touch. The MVC model divides up all functionality into three distinct categories Model The classes that hold your application s data View Made up of the windows controls and other elements that the user can see and interact with Controller. Binds the model and view together and is the application logic that decides how to handle the user s inputs The goal in MVC is to make the objects that implement these three types of code as distinct from one another as possible. Any object you write should be readily identifiable as belonging in one of the three categories with little or no functionality within it that could be classified within either of the other two. An object that implements a button for example shouldn t contain code to process data when that button is tapped and code that implements a bank account shouldn t contain code

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.