tailieunhanh - iPhone SDK Programming A Beginner’s Guide phần 8

Đảm bảo cấu hình mặc định nhà nước được lựa chọn. 12. Thay đổi nền và thay đổi hình ảnh để . 13. Nổi bật với cấu hình nhà nước và thay đổi nền để Đối với nút thứ ba, đảm bảo cấu hình mặc định nhà nước được lựa chọn và thêm các văn bản | Chapter 13 Controls Part Two Using Pickers and Using the Camera 321 property nonatomic retain IBOutlet UIPickerView myPicker property nonatomic retain IBOutlet MyPickerDelegate myPickerDelegate - IBAction changeColor id sender end Listing 13-10 import implementation APickerViewController synthesize myPicker synthesize myPickerDelegate - IBAction changeColor id sender NSLog the color is NSString objectAtIndex myPicker selectedRowInComponent 0 - void dealloc myPickerDelegate release myPicker release super dealloc end Listing 13-11 Debug console output from running APicker application Session started at 2009-02-06 22 57 09 -0500. 2009-02-06 22 57 APicker 429 20b picked row 1 component 0 2009-02-06 22 57 APicker 429 20b the value Yellow 2009-02-06 22 57 APicker 429 20b picked row 3 component 0 2009-02-06 22 57 APicker 429 20b the value Blue 2009-02-06 22 57 APicker 429 20b picked row 8 component 0 2009-02-06 22 57 APicker 429 20b the value Tan 2009-02-06 22 57 APicker 429 20b the color is Tan 2009-02-06 22 57 APicker 429 20b picked row 10 component 0 2009-02-06 22 57 APicker 429 20b the value Coral 2009-02-06 22 57 APicker 429 20b the color is Coral A UlPickerView must have helper classes adopting the UIPickerViewDelegate and UIPickerViewDataSource protocols. In this example you had one class MyPickerDelegate adopt both protocols. The delegate uses a simple NSArray to hold NSString objects. Because the data is simple strings the delegate implements the titleForRow method. When a user selects a row the didSelectRow method logs the row component and value to the debugger console. 322 iPhone SDK Programming A Beginner s Guide Try This Using a UlPickerView with Two Components 1. Open APicker application in Xcode. 2. Modify MyPickerDelegate s numberOfComponentsInPickerView to return the number 2 Listing 13-13 . 3. Click Build And Go.

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.