TAILIEUCHUNG - Learn Objective C on the Mac phần 4

Đây là tiện dụng cho hành vi đó là không bị ràng buộc một đối tượng cụ thể, nhưng là toàn cầu đến lớp. Ví dụ tốt nhất của loại thông báo phân bổ một đối tượng mới. Khi bạn muốn có một vòng tròn mới, nó phù hợp với yêu cầu lớp Circle cho rằng đối tượng mới, chứ không phải là yêu cầu một vòng tròn hiện có. | 88 CHAPTER 6 Source File Organization The other part of a class s source is the implementation. The implementation section tells the Objective-C compiler how to make the class actually work. This section contains the code that implements the methods declared in the interface. Because of the natural split in the definition of a class into interface and implementation a class s code is often split into two files along the same lines. One part holds the interface components the interface directive for the class any public struct definitions enum constants defines extern global variables and so on. Because of Objective-C s C heritage this stuff typically goes into a header file which has the same name as the class with a .h at the end. For example class Engine s header file would be called and Circle s header file would be . All the implementation details such as the implementation directive for the class definitions of global variables private structs and so on go into a file with the same name as the class and a .m at the end sometimes called a dot-m file . and would be the implementation files for those classes. NOTE__ If you use .mm for the file extension you re telling the compiler you ve written your code in Objective-C which lets you use C and Objective-C together. Making New Files in Xcode When you build a new class Xcode makes your life easier by automatically creating the .h and .m files for you. When you choose File New File in Xcode you get a window like the one shown in Figure 6-1 that presents you with a list of the kinds of files that Xcode knows how to create. Select Objective-Cclass and click Next. You ll get another window asking you to fill in the name as shown in Figure 6-2. You can see a bunch of other things in that window. There s a checkbox you can use to have Xcode create for you. If you had multiple projects open you could use

TỪ KHÓA LIÊN QUAN
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.