iPhone SDK 3 Programming Advanced Mobile Development for Apple iPhone and iPod touc phần 6

Nếu bạn bỏ qua phương pháp này khởi tạo và sử dụng initWithFrame của UIView: khởi tạo, phong cách UITableViewStylePlain sẽ được sử dụng theo mặc định. Để làm cho mã của bạn có thể đọc được, bạn phải luôn xác định rõ ràng phong cách của bảng ngay cả khi nó là mặc định. | File Management 319 Croups Files FileMgmt6 Classes Other Sources h wj Resources B filetxt _J Frameworks Products Targets Executables 15 Errors and Warnings Find Results Bookmarks SCM 0 Project Symbols a Implementation Files tá NIB Files Figure XCode s Groups and Files screenshot. occurrence of a file with the exact name if the ext parameter is nil or empty. The location of the in the bundle value of filePath in main function is var mobile Applications 5ABEB448-7634-4AE8-9833-FC846A81B418 Remember what we have mentioned before that you should not change items in the .app directory as it will affect code signing. Therefore to modify a file in the bundle you need to copy it to a different directory and change it there. After locating the file in the bundle and storing its absolute path in filePath we load its contents into an NSData object using the dataWithContentsOfFile method. Next the file Documents is created containing the contents of the bundled file. The original file contains a single line This is the contents of a file. We would like to modify the copied file by replacing the text contents with the text modified . We would like to perform this task by using low-level file operations involving seeking rather than loading the whole file into memory changing it and storing it back to disk. 320 iPhone SDK 3 Programming To perform low-level file operations you need to obtain an NSFileHandle instance. This class encapsulates the low-level mechanism for accessing files. The nature of operations that you would like to perform on the file determines the method you use to obtain the NSFileHandle instance. The following are the three NSFileHandle class methods available to you Reading. To obtain the instance for read-only access use the class method fileHandleFor-ReadingAtPath which is declared as follows id fileHandleForReadingAtPath NSString path Writing. To obtain .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
9    99    2    29-05-2024
Đã 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.