Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Sức khỏe - Y tế
Văn bản luật
Nông Lâm Ngư
Kỹ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Giới thiệu
Đăng ký
Đăng nhập
Tìm
Danh mục
Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Y tế sức khỏe
Văn bản luật
Nông lâm ngư
Kĩ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Thông tin
Điều khoản sử dụng
Quy định bảo mật
Quy chế hoạt động
Chính sách bản quyền
Giới thiệu
Đăng ký
Đăng nhập
0
Trang chủ
Công Nghệ Thông Tin
Kỹ thuật lập trình
iPhone SDK Programming A Beginner’s Guide phần 9
Đang chuẩn bị liên kết để tải về tài liệu:
iPhone SDK Programming A Beginner’s Guide phần 9
Sơn Quyền
36
48
pdf
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Phương pháp này có một đối tượng dữ liệu có khả năng ghi và trả về đối tượng lưu trữ như một id. Sau đó, bạn có thể viết các kho lưu trữ vào đĩa. Các bước để tạo và viết một kho lưu trữ vào đĩa như sau. Sau khi khởi tạo NSKeyedArchiver, mã hóa các đối tượng lưu trữ. | Chapter 15 Property Lists and Archiving 369 NSKeyedArchiver and NSKeyedUnarchiver The NSKeyedArchiver class archives objects while the NSKeyedUnarchiver class unarchives objects. NSKeyedArchiver NSKeyedArchiver stores one or more objects to an archive using the initForWritingWith MutableData method. To be archived an object must implement the NSCoding protocol. - id initForWritingWithMutableData NSMutableData data This method takes a writable data object and returns the archived object as an id. You can then write the archive to disk. The steps for creating and writing an archive to disk are as follows. First create an NSMutableData object. NSMutableData theData NSMutableData data After creating the data object create an NSKeyedArchiver passing the newly created data object as a parameter. NSKeyedArchiver archiver NSKeyedArchiver alloc initForWritingWithMutableData theData After initializing the NSKeyedArchiver encode the objects to archive. If you wish you can encode multiple objects using the same archiver provided all archived objects adopt the NSCoding protocol. The following code snippet illustrates. archiver encodeObject objectA forKey @ a archiver encodeObject objectB forKey @ b archiver encodeObject objectC forKey @ c archiver finishEncoding After archiving write the data object which now contains the archived objects to a file. theData writeToFile myfile.archive atomically YES NSKeyedUnarchiver You use NSKeyedUnarchiver to unarchive an archive. NSKeyedUnarchiver reconstitutes one or more objects from a data object that was initialized with an archive. To be unarchived an object must implement the NSCoding protocol. When programming for the iPhone you use the initForReadingWithData method. - id initForReadingWithData NSData data 370 iPhone SDK Programming A Beginner s Guide The steps to unarchive are similar to archiving. First create an NSData object from the previously archived file. NSData theData NSData dataWithContentsOfFile myfile.archive After .
TÀI LIỆU LIÊN QUAN
Beginning iPhone 3 Development Exploring the iPhone SDK
Beginning iPhone 4 Development Exploring the iOS SDK
Begining iPad Development for iPhone Developers
The iOS 6 Programming Cookbook
iPhone SDK 3 Programming Advanced Mobile Development for Apple iPhone and iPod touc phần 1
iPhone SDK 3 Programming Advanced Mobile Development for Apple iPhone and iPod touc phần 2
iPhone SDK 3 Programming Advanced Mobile Development for Apple iPhone and iPod touc phần 3
iPhone SDK 3 Programming Advanced Mobile Development for Apple iPhone and iPod touc phần 4
iPhone SDK 3 Programming Advanced Mobile Development for Apple iPhone and iPod touc phần 5
iPhone SDK 3 Programming Advanced Mobile Development for Apple iPhone and iPod touc phần 6
crossorigin="anonymous">
Đã 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.