Tôi có XIB
tệp TimerCell.xib với UITableViewCell
. Trong lớp khác trong cellForRowAtIndexPath tôi khởi tạo này UITableViewCell
:Cách đặt Hành động cho UIButton trong UITableViewCell
static NSString *CellIdentifier = @"cellTimer";
TimerCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
//cell = [[TimerCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"TimerCell"owner:self options:nil];
cell = [nib objectAtIndex:0];
Trong tôi TimerCell Tôi có hai UILabel
và một UIButton
. Đối với nút này, tôi muốn đặt hành động cho một số phương pháp.
Tôi có thể làm như thế nào? Và làm thế nào để hiển thị trong UILabel
dữ liệu đầu tiên từ đồng hồ đếm ngược nền của tôi trong thời gian thực?
nó hoạt động! Cảm ơn bạn!! Làm thế nào để đặt thẻ cho nó ngay bây giờ? Trước khi nó được ** cell.staticButton.tag = indexPath.row; ** – Romowski
Kiểm tra câu trả lời đã chỉnh sửa của tôi @Romowski – Dany