- Get link
- X
- Other Apps
- Get link
- X
- Other Apps
Button events in custom cell in TableView,
Create Button in Custom View,
In MyCustomCellTableViewCell.h,
@property (weak, nonatomic) IBOutlet UIButton *btnDownload;
In tableview class,
#import "MyCustomCellTableViewCell.h"
In
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath{
cell.btnDownload.tag = indexPath.row;
[cell.btnDownload addTarget:self action:@selector(yourButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
}
Create method for custom button clicked
-(void)yourButtonClicked:(UIButton*)sender
{
NSLog(@"index: %@",sender.tag);
}
Comments
This comment has been removed by a blog administrator.
ReplyDelete