TAILIEUCHUNG - iPhone Design Award-Winning Projects phần 2

Bạn cũng sẽ cần phải tạo ra một lớp học để đi cùng với tế bào xem bảng mới của bạn. Vì chúng ta đang tùy biến các tế bào điều khiển dự đoán, chọn thư mục lớp học, hãy vào File New, và tạo ra một lớp con của UITableViewCell được gọi là PredictionCell, như thể hiện trong hình 7-22. | implementation FirstLastExampleTableViewCell synthesize firstText synthesize lastText static UIFont firstTextFont nil static UIFont lastTextFont nil void initialize if self FirstLastExampleTableViewCell class firstTextFont UIFont systemFontOfSize 20 retain lastTextFont UIFont boldSystemFontOfSize 20 retain this is a good spot to load any graphics you might be drawing in -drawContentView just load them and retain them here ONLY if they re small enough that you don t care about them wasting memory the idea is to do as LITTLE work . allocations in -drawContentView as possible - void dealloc firstText release lastText release super dealloc the reason I don t synthesize setters for firstText and lastText is because I need to call -setNeedsDisplay when they change - void setFirstText NSString s firstText release firstText s copy self setNeedsDisplay - void setLastText NSString s lastText release lastText s copy self setNeedsDisplay - void drawContentView CGRect r CGContextRef context UIGraphicsGetCurrentContext UIColor backgroundColor UIColor whiteColor UIColor textColor UIColor blackColor if 10 CHAPTER 1 Tweetie . backgroundcolor UlColor clearColor textcolor UlColor whiteColor backgroundColor set CGContextFillRect context r CGPoint p 12 9 textColor set CGSize s firstText drawAtPoint p withFont firstTextFont 6 space between words lastText drawAtPoint p withFont lastTextFont @end reads import @interface ABTableViewCellView UIView @end @implementation ABTableViewCellView - void drawRect CGRect r ABTableViewCell self superview drawContentView r @end @implementation ABTableViewCell reads import UIKit to use subclass ABTableViewCell and implement -drawContentView @interface ABTableViewCell UITableViewCell UIView contentView - void drawContentView CGRect r subclasses should implement @end CHAPTER 1 Tweetie 11 reads FastScrolling Created by .

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.