【Swift】 Twitter 아래에서 나오는 메뉴를 만들고 싶다! ! ! (PanModal)
Twitter 아래에서 나오는 메뉴! 사용하기 쉽습니다.



↑ 이런 느낌이었기 때문에 뇨키가 나오는 녀석
구현해라! ! ! 😳😳😳
라이브러리를 사용하여 구현합시다.
보통 라이브러리없이도 만들 수 있다고 생각하지만, 역시 귀찮다.
그럴 수있는 것 같은 라이브러리를 찾고 왔어! 🙋♂️
htps : // 기주 b. 코 m / s ぁ chqq / 판 모다 l

어딘가에서 본 적이 있구나-라는 사람 있잖아?
"슈카카카"로 친숙한 Slack의 라이브러리입니다.
라는 이유로 이 녀석을 사용하여 Twitter 같은 녀석과 메뉴를 만들어 줘! ! !
만들자!
1. 라이브러리를 넣자
cocoapods를 사용해요!
Podfile에 이것을 추가하고 pod install하십시오!
pod 'PanModal'
2. 넉넉하게 만드는 버튼 추가
원하는대로 Button이나 TableView를 넣어 보자.
이것을 눌렀을 때 뇨키와 메뉴가 나오는 것 같은 이미지!

3. 뇨키와 메뉴 본체를 만든다
새로운 파일을 만들자!
이름은 뭐든지

그래서 UITableViewDelegate와 UITableViewDataSource, 그리고 그것과 관련된 무언가를 작성하십시오!
(UITableView에서 좋다고 생각했습니다만, 뭔가 잘 움직이지 않았기 때문에 이렇게 하고 있습니다 수수께끼입니다)

다음에 뇨키와의 키모를 만들어 줘!

PanModal을 가져오고,

모두 쓰자!
이것으로 뇨키와 메뉴 자체는 완성!
4. 뇨키와 메뉴를 불러보자!
뇨키와 메뉴를 내고 싶은 타이밍에,
ViewController.swiftpresentPanModal(NyokittoViewController())
이 녀석을 부르면 오케이!

5. 완성!
이것으로 트위터의 메뉴 같은 뇨키와 메뉴가 완성! 고마워요~~~~~~


6. 여러가지 개량해라!
↑의 녀석이라면 문제점이 여러 가지 있기 때문에 개량하자! 라는 사람입니다.
뭔가 메뉴가 스크롤됩니다.
그런 때는 이것을 추기한다!
tableView.isScrollEnabled = false
이것을 설정하면 tableView가 스크롤하지 않게 됩니다! 편리하네!
헤더를 원하지만
그런 때는 헤더를 만들자!
let headerView:UIView = UIView()
let label: UILabel = UILabel()
헤더 뷰와 거기에 올리고 싶은 것을 정의
이것을 추가
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
return headerView
}
override func viewDidLayoutSubviews() {
label.text = "共有"
label.textAlignment = .center
label.textColor = .black
label.font = UIFont.systemFont(ofSize: 14)
label.frame = CGRect(x: 0, y: 0, width: headerView.frame.width, height: headerView.frame.height)
headerView.addSubview(label)
}
그리고 header의 높이를 바꾸고 싶을 때는
tableView.sectionHeaderHeight = 40
그러면 이런 느낌!

구분선 방해이지만
그런 때는 이것을 추기
tableView.separatorStyle = .none

메뉴를 누르면 움직임을 쓰고 싶습니다.
이렇게 쓴다!
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true) //選択解除
/*
ここになんやかんや書く
*/
}
모두들 뇨키와 메뉴 만들자!
모두들 뇨키와 메뉴 만들자!
왠지 상당히 구운 칼날인 방법이지만, 조금 실장하고 싶을 때라든지 참고로 해 주세요(절대 이런 것보다 좋은 방법 있는,,,,,,)
GitHub도 주었기 때문에 참고해 봐!
htps : // 기주 b. 코 m / 너무 조타로 / 넉넉한
참고
환경
Xcode 버전: 11.5
도서관: PanModal
Reference
이 문제에 관하여(【Swift】 Twitter 아래에서 나오는 메뉴를 만들고 싶다! ! ! (PanModal)), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/sugijotaro/items/b5ce167421009a4fe8e9
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
보통 라이브러리없이도 만들 수 있다고 생각하지만, 역시 귀찮다.
그럴 수있는 것 같은 라이브러리를 찾고 왔어! 🙋♂️
htps : // 기주 b. 코 m / s ぁ chqq / 판 모다 l

어딘가에서 본 적이 있구나-라는 사람 있잖아?
"슈카카카"로 친숙한 Slack의 라이브러리입니다.
라는 이유로 이 녀석을 사용하여 Twitter 같은 녀석과 메뉴를 만들어 줘! ! !
만들자!
1. 라이브러리를 넣자
cocoapods를 사용해요!
Podfile에 이것을 추가하고 pod install하십시오!
pod 'PanModal'
2. 넉넉하게 만드는 버튼 추가
원하는대로 Button이나 TableView를 넣어 보자.
이것을 눌렀을 때 뇨키와 메뉴가 나오는 것 같은 이미지!

3. 뇨키와 메뉴 본체를 만든다
새로운 파일을 만들자!
이름은 뭐든지

그래서 UITableViewDelegate와 UITableViewDataSource, 그리고 그것과 관련된 무언가를 작성하십시오!
(UITableView에서 좋다고 생각했습니다만, 뭔가 잘 움직이지 않았기 때문에 이렇게 하고 있습니다 수수께끼입니다)

다음에 뇨키와의 키모를 만들어 줘!

PanModal을 가져오고,

모두 쓰자!
이것으로 뇨키와 메뉴 자체는 완성!
4. 뇨키와 메뉴를 불러보자!
뇨키와 메뉴를 내고 싶은 타이밍에,
ViewController.swiftpresentPanModal(NyokittoViewController())
이 녀석을 부르면 오케이!

5. 완성!
이것으로 트위터의 메뉴 같은 뇨키와 메뉴가 완성! 고마워요~~~~~~


6. 여러가지 개량해라!
↑의 녀석이라면 문제점이 여러 가지 있기 때문에 개량하자! 라는 사람입니다.
뭔가 메뉴가 스크롤됩니다.
그런 때는 이것을 추기한다!
tableView.isScrollEnabled = false
이것을 설정하면 tableView가 스크롤하지 않게 됩니다! 편리하네!
헤더를 원하지만
그런 때는 헤더를 만들자!
let headerView:UIView = UIView()
let label: UILabel = UILabel()
헤더 뷰와 거기에 올리고 싶은 것을 정의
이것을 추가
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
return headerView
}
override func viewDidLayoutSubviews() {
label.text = "共有"
label.textAlignment = .center
label.textColor = .black
label.font = UIFont.systemFont(ofSize: 14)
label.frame = CGRect(x: 0, y: 0, width: headerView.frame.width, height: headerView.frame.height)
headerView.addSubview(label)
}
그리고 header의 높이를 바꾸고 싶을 때는
tableView.sectionHeaderHeight = 40
그러면 이런 느낌!

구분선 방해이지만
그런 때는 이것을 추기
tableView.separatorStyle = .none

메뉴를 누르면 움직임을 쓰고 싶습니다.
이렇게 쓴다!
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true) //選択解除
/*
ここになんやかんや書く
*/
}
모두들 뇨키와 메뉴 만들자!
모두들 뇨키와 메뉴 만들자!
왠지 상당히 구운 칼날인 방법이지만, 조금 실장하고 싶을 때라든지 참고로 해 주세요(절대 이런 것보다 좋은 방법 있는,,,,,,)
GitHub도 주었기 때문에 참고해 봐!
htps : // 기주 b. 코 m / 너무 조타로 / 넉넉한
참고
환경
Xcode 버전: 11.5
도서관: PanModal
Reference
이 문제에 관하여(【Swift】 Twitter 아래에서 나오는 메뉴를 만들고 싶다! ! ! (PanModal)), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/sugijotaro/items/b5ce167421009a4fe8e9
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
pod 'PanModal'
presentPanModal(NyokittoViewController())
tableView.isScrollEnabled = false
let headerView:UIView = UIView()
let label: UILabel = UILabel()
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
return headerView
}
override func viewDidLayoutSubviews() {
label.text = "共有"
label.textAlignment = .center
label.textColor = .black
label.font = UIFont.systemFont(ofSize: 14)
label.frame = CGRect(x: 0, y: 0, width: headerView.frame.width, height: headerView.frame.height)
headerView.addSubview(label)
}
tableView.sectionHeaderHeight = 40
tableView.separatorStyle = .none
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true) //選択解除
/*
ここになんやかんや書く
*/
}
모두들 뇨키와 메뉴 만들자!
왠지 상당히 구운 칼날인 방법이지만, 조금 실장하고 싶을 때라든지 참고로 해 주세요(절대 이런 것보다 좋은 방법 있는,,,,,,)
GitHub도 주었기 때문에 참고해 봐!
htps : // 기주 b. 코 m / 너무 조타로 / 넉넉한
참고
환경
Xcode 버전: 11.5
도서관: PanModal
Reference
이 문제에 관하여(【Swift】 Twitter 아래에서 나오는 메뉴를 만들고 싶다! ! ! (PanModal)), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/sugijotaro/items/b5ce167421009a4fe8e9텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)