일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- geofencing
- Archive
- Code
- 개발자
- iOS16
- JPA
- error
- MacOS
- view
- Swift
- Session
- Notification
- github
- UIButton
- 한글
- appstore
- Xcode
- FLUTTER
- mac
- IOS
- Git
- darkmode
- Firebase
- Apple
- window
- SwiftUI
- Realm
- rxswift
- 웹뷰
- 이미지
- Today
- Total
목록cell (3)
EEYatHo 앱 깎는 이야기
셀을 눌렀을 때, 전체적으로 회색이 되는 효과를 없애는 방법입니다. class MyCell: UITableViewCell { ... func myLayoutFunc() { ... selectionStyle = .none ... } ... }
class MyCell: UITableViewCell { ... func initFunc() { ... myButton.addTarget(self, action: #selector(myFunc(_:)), for: .touchUpInside) ... } @objc myFunc(sender: UIButton) { ... } ... } 이런식으로 셀 안에서 addTarget으로 셀 안에 있는 @objc func을 연결해줘봤자, .touchUpInside 이벤트를 받고, 처리하는 객체는 Cell 보다 상위에 있는 뷰컨트롤러가 합니다. 그래서 self는 상위에 있는 뷰컨으로 바뀌어야 할 것이며, @objc함수로 뷰컨에다가 선언해야합니다. 그러면 셀 안에 굳이 VC를 전달하고, 다시 함수를 참조해야하는데, 그것보다..
일반적으로 shadow랑 corner radius를 같이하면 적용이 안되는데, Cell은 비교적 쉽게 구현할 수 있다. Cell 안에서 Layout할 때, func setupLayout() { layer.shadowColor = UIColor.black.cgColor layer.shadowOpacity = 0.5 layer.shadowRadius = 10 contentView.layer.cornerRadius = 10 contentView.layer.masksToBounds = true } 이렇게, Cell 에 shadow를 넣고, Cell의 contentView에 corner radius를 넣으면 된다.