tôi đang cố gắng để thực hiện một TableView đó mỗi tế bào có một nút '+
' giống như các ứng dụng iPod khi thêm bài hát vào danh sách phát.Add "Plus" nút cho AccessoryType TableView
Các cell.accesoryType
chỉ có bốn giá trị
UITableViewCellAccessoryCheckmark
UITableViewCellAccessoryDetailDisclosureButton
UITableViewCellAccessoryDisclosureIndicator
và
None
Làm thế nào điều này có thể được thực hiện? Làm tôi cần phải tạo ra một nút tùy chỉnh và thiết lập cell.accessoryView
hoặc là có một cách khác để làm điều này?
Tìm thấy giải pháp UIButton * nút = [UIButton buttonWithType: UIButtonTypeContactAdd]; [nút addTarget: tự động: @selector (buttonTapped: sự kiện :) forControlEvents: UIControlEventTouchUpInside]; cell.accessoryView = button; và tạo quy trình xử lý sự kiện - (void) buttonTapped: (id) người gửi sự kiện: (id) event { } – teo