let cell = tableView.dequeueReusableCell(withIdentifier: "cell") as! HomeTableViewCell
cell.selectionStyle = .none
let image = UIImage(named:"twodimg_"+"\(indexPath.row+1)")
cell.feedImageView.image = image
let button = UIButton(frame: CGRect(x: 0, y: 0, width: cellFrame.width, height: cellFrame.height))
button.setTitle("fff", for: .normal)
button.titleLabel?.layer.opacity = 0.0;
button.addTarget(self, action: #selector(onClickCheck(_:)), for: .touchUpInside)
cell.addSubview(button)
return cell
debugPrint("title is", (sender as? UIButton)?.titleLabel?.text)
기본 코드다. 이미지만 쓰는 테이블 뷰를 만들고 데이터를 title 로 보내는 것을 만들고 있다. button에 extension을 달아도 되지만 title자체를 쓰지 않으니 타이틀을 텍스트에 실어 보내는.
이미지 번호를 row로 세팅하는 것처럼 객체 배열 번호를 넣어주면 된다.
인터넷 보니 tag 밖에 없어 int 만 전달할 수 없으니 내가 만드는 제품에는 불편해서 생각해 본 아이디어.
'XaaS > FireBase' 카테고리의 다른 글
swift log level (0) | 2021.05.28 |
---|---|
coredata 를 배열로 쓰기 (0) | 2021.05.23 |
Snapkit 실무 코드 (0) | 2021.05.20 |
POD (0) | 2021.05.20 |
List (0) | 2021.05.18 |
최근댓글