Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ [FEAT] 홈 배너 UI 구현 #421

Merged
merged 14 commits into from
Aug 12, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,30 @@ import Then
class HomeBannerTVC: BaseTVC {

// MARK: Components
private let bannerCV = UICollectionView()
private let bannerCV = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewLayout()).then {
$0.showsHorizontalScrollIndicator = false
$0.isPagingEnabled = true
}
private lazy var segmentedControl = UISegmentedControl().then {
$0.removeAllSegments()
for i in 0..<bannerImaURLsData.count - 2 {
$0.insertSegment(with: UIImage(named: "unselectedSegmentImage"), at: i, animated: false)
}
$0.setDividerImage(UIImage(), forLeftSegmentState: .normal, rightSegmentState: .normal, barMetrics: .default)
$0.setBackgroundImage(UIImage(), for: .normal, barMetrics: .default)
$0.selectedSegmentIndex = 0
$0.setImage(UIImage(named: "selectedSegmentImage"), forSegmentAt: $0.selectedSegmentIndex)
$0.isUserInteractionEnabled = false
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요기서 UISegmentedControl 말고 기본 UIPageControl을 사용하면 iOS HIG에 기반한 기본 페이징 컨트롤 컴포넌트를 사용해서 구현할 수 있을거 같은데 UISegmentedControl로 구현한 이유가 있나용~??
그 page item들 간에 간격이 너무 커서 고민이라면 그냥 기본 컴포넌트 쓰는것도 좋을 것 같애!!
tintColor / currentPageTintColor로 color 값으로 선택된 페이지, 그렇지 않은 페이지를 표시할 수 있어서 이미지도 사용하지 않아도 되구!!!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hwangJi-dev 앗. ㅋ ㅋ ㅋ 이거 해주는 애가 있었구나.?.?.?.?.??..?.??.? 바로 리팩 갈길게 거마워... ㅎ.......

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

굿,,저도 동의합니다!! UIPageControl 추천!! 온보딩에도 얘 써줬어 코드 참고해봐도 좋을듯~!!


// MARK: - Properties
private lazy var CVFlowLayout = UICollectionViewFlowLayout().then {
$0.scrollDirection = .horizontal
$0.minimumLineSpacing = 0
$0.minimumInteritemSpacing = 0
$0.sectionInset = .zero
$0.itemSize = CGSize.init(width: screenWidth, height: 104)
}

// MARK: - Initialization
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
Expand Down