TAILIEUCHUNG - Lập trình Wrox Professional Xcode 3 cho Mac OS part 25

Các vòng lặp trong khi duyệt qua các đối tượng trong một bộ sưu tập bằng cách sử dụng một đối tượng NSEnumerator. Sử dụng [điều tra viên nextObject] nhắn tin để có được từng đối tượng. Bắt đầu với các đối tượng rst fi trong bộ sưu tập. Quy trình từng đối tượng, để, không bỏ qua đối tượng (điều này không ngăn cản việc thoát khỏi vòng đầu bằng cách sử dụng một lệnh break) | Updating a Project to Objective-C 197 Loop modernization only transforms while loops that meet these criteria The while loop iterates through the objects in a collection using an NSEnumerator object. Uses the message enumerator nextObject to obtain each object. Starts with the first object in the collection. Processes each object in order without skipping objects this does not preclude exiting the loop early using a break statement . The second and third points mean that you can t use refactoring to modernize a loop that uses -reverseObjectEnumerator. 0 An often-overlooked feature of fast enumeration is that the modern NSEnumerator class also conforms to NSFastEnumeration. The implication is that any enumerator object can be treated as the collection object in a fast enumeration statement. Consider the following code NSEnumerator e collection reverseObjectEnumerator for id obj in e The enumerator acts as a proxy for its collection. The statement loops through the objects returned by the enumerator. This is particularly useful with enumerators that return a subset of a collection or process objects in a different order like - NSDictionary keysSortedByValueUsingSelector . It should be noted that this trick does not improve the performance of your application a fast enumeration using an enumerator object isn t any faster than using the enumerator object directly. In other words you don t get the fast part of fast enumeration you just get the convenience of a concise syntax. UPDATING A PROJECT TO OBJECTIVE-C The Edit Convert to Objective-C command is specifically designed to ease that transition of legacy projects to Objective-C . It optionally performs two transitions on every source file in your project Modernize Loops Convert instance variables to properties To update your entire project to Objective-C follow these steps 1. Choose the Edit Convert to Objective-C command. 2. Select either or both of the Modernize loops or Use properties .

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.