TAILIEUCHUNG - Praise for The iPhone Developer’s Cookbook 2nd phần 2

"Chúng tôi làm cho cuộc sống của chúng tôi bằng văn bản công cụ này, nhưng tôi hạ mình bởi lệnh của Erica vấn đề của mình và cách cô ấy trình bày các vật liệu: vui vẻ chính thức, sau đó rấtvà UISearchDisplayControllers thay vì xây dựng và quản lý quan điểm trực tiếp. | Recipe Using Instruments to Detect Leaks 59 Caching When you load too much data at once you can also run short of memory. Holding on to everything in your program when you are using memory-intense resources such as images audio or PDFs may cause strategy called caching lets you delay loads until resources are actually needed and release that memory when the system needs it. The simplest approach involves building a cache from a NSMutableDictionary object. A basic object cache works like queried the cache checks to see whether the requested object has already been loaded. If it has not the cache sends out a load request based on the object object load method might retrieve data locally or from the Web. Once loaded it stores the new information in memory for quick recall. This code here performs the first part of a cache s duties. It delays loading new data into memory until that data is specifically requested. In real life you probably want to type your data and return objects of a particular class rather than use the generic id type. - id retrieveObjectNamed NSString someKey id object objectForKey someKey if object object self loadObjectNamed someKey setObject object forKey someKey return object The second duty of a cache is to clear itself when the application encounters a low-memory a dictionary-based cache all you have to do is remove the the next retrieval request arrives the cache can reload the requested object. - void respondToMemoryWarning removeAllObjects Combining the delayed loads with the memory-triggered clearing allows a cache to operate in a memory-friendly manner. Once objects are loaded into memory they can be used and reused without loading delays. However when memory is tight the cache does its part to free up resources that are needed to keep the application running. Recipe Using Instruments to Detect Leaks Instruments plays an important role in .

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.