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

๐ŸคŸ๐Ÿป 3์ฃผ์ฐจ ๊ณผ์ œ #12

Merged
merged 24 commits into from
Aug 14, 2023
Merged

Conversation

ena-isme
Copy link
Contributor

@ena-isme ena-isme commented Aug 1, 2023

โญ๏ธ3์ฃผ์ฐจโญ๏ธ


3์ฃผ์ฐจ ๊ณผ์ œ์—์„œ๋Š” 2์ฃผ์ฐจ์— ์ด์–ด Tving ํด๋ก  ์ฝ”๋”ฉ์„ ํ•˜์˜€์Šต๋‹ˆ๋‹ค. ๊ธฐ๋ณธ๊ณผ์ œ๋กœ ๋งˆ์ดํŽ˜์ด์ง€๋ฅผ ๊ตฌํ˜„ํ•˜์˜€๊ณ , ์‹ฌํ™”๊ณผ์ œ๋กœ ํ™ˆ๋ทฐ๋ฅผ ๊ตฌํ˜„ํ•˜์˜€์Šต๋‹ˆ๋‹ค.


ํ™ˆ๋ทฐ๋Š” ์ „์ฒด๋ฅผ ํ•˜๋‚˜์˜ collectionView ๋กœ ๊ตฌํ˜„ํ•œ ๋’ค ๊ฐ๊ฐ์˜ cell ์— ๋‹ค์‹œ scrollView ๋ฅผ ์˜ฌ๋ฆฌ๊ณ  collcetionView ๋ฅผ ์Œ“๋Š” ๋ฐฉ์‹์œผ๋กœ ๊ตฌํ˜„ํ•˜์˜€์Šต๋‹ˆ๋‹ค. ํ™ˆ์„ ์ œ์™ธํ•œ ๋‚˜๋จธ์ง€ TV, ํŒŒ๋ผ๋งˆ์šดํŠธ+ ๋“ฑ์€ ์ด๋ฏธ์ง€์ž…๋‹ˆ๋‹ค :)


โญ๏ธ์ฃผ์š”์ฝ”๋“œโญ๏ธ

SceneDelegate ์—์„œ ๋„ค๋น„๊ฒŒ์ด์…˜๋ฐ” ๋•Œ๋ฌธ์— ๋ ˆ์ด์•„์›ƒ์ด ์ž˜ ์žกํžˆ์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค. ํ‰์†Œ์— navigationBar๋ฅผ ์‹ ๊ฒฝ์“ฐ์ง€ ๋ชปํ•˜์˜€๋Š”๋ฐ ์กด์žฌ๋ฅผ ๋‹ค์‹œ๊ธˆ ์•Œ ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

//In SceneDelegate
navigationController.navigationBar.isHidden = true
self.window?.rootViewController = navigationController
self.window?.makeKeyAndVisible()

์‹ฌํ™”๊ณผ์ œ์—์„œ HomeCollectionView ๋ฅผ ์Šคํฌ๋กคํ•˜์—ฌ ํ™”๋ฉด์„ ๋„˜๊ธธ ๋•Œ๋Š” HomeCollectionViewCell ์— ๋งž์ถฐ HomeTabBarCell ๋„ ์ž˜ ์„ ํƒ๋˜์—ˆ์ง€๋งŒ ๋ฐ˜๋Œ€๋กœ HomeTabBarCell ๋ฅผ ํด๋ฆญํ•  ๋•Œ๋Š” HomeCollectionViewCell ์ด ๋„˜์–ด๊ฐ€๊ธด ํ•˜์ง€๋งŒ ์œ„์— HomeMainView ๊ฐ€ ๊ณ ์ •๋˜์–ด ์žˆ๋Š” ์˜ค๋ฅ˜๊ฐ€ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ์•„๋ž˜์™€ ๊ฐ™์ด ํ•ด๊ฒฐํ•˜์˜€์Šต๋‹ˆ๋‹ค.


//In HomeViewController
if collectionView == rootView.tabBarView {
            rootView.homeContentView.isPagingEnabled = false
            rootView.homeContentView.scrollToItem(at: indexPath, at: .centeredHorizontally, animated: true)
            rootView.homeContentView.isPagingEnabled = true
)

์‹ฌํ™”๊ณผ์ œ์—์„œ tabBar ๋ฅผ ํด๋ฆญํ•  ๋•Œ ์„ ํƒ๋œ Cell ์ด ํ•ธ๋“œํฐ ํ™”๋ฉด ๋„ˆ๋จธ ์œ„์น˜ํ•˜๊ณ  ์žˆ๋‹ค๋ฉด ํ™”๋ฉด ๋‚ด์— ๋ณด์ด๋„๋ก ํ•˜๋Š” ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ์ถ”๊ฐ€ํ•˜์˜€์Šต๋‹ˆ๋‹ค.


func scrollViewDidScroll(_ scrollView: UIScrollView) {
        let velocity = scrollView.panGestureRecognizer.velocity(in: scrollView)
        if velocity.x < 0 {
            direction = -1 }
        else if velocity.x > 0 {
            direction = 1 }
    }
func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {

            if direction > 0 {
                rootView.tabBarView.scrollToItem(at: indexPath, at: .centeredHorizontally, animated: true)}
            
            else {
                rootView.tabBarView.scrollToItem(at: indexPath, at: .left, animated: true)}
        }
    }

โญ๏ธ์‹ค์Šต๊ฒฐ๊ณผโญ๏ธ


๊ธฐ๋ณธ๊ณผ์ œ


แ„’แ…ชแ„†แ…งแ†ซ แ„€แ…ตแ„…แ…ฉแ†จ 2023-08-15 แ„‹แ…ฉแ„Œแ…ฅแ†ซ 12 05 28


์‹ฌํ™”๊ณผ์ œ


แ„’แ…ชแ„†แ…งแ†ซ แ„€แ…ตแ„…แ…ฉแ†จ 2023-08-15 แ„‹แ…ฉแ„Œแ…ฅแ†ซ 12 03 05

@ena-isme ena-isme self-assigned this Aug 2, 2023
@ena-isme ena-isme changed the title 3์ฃผ์ฐจ ๊ณผ์ œ ๐ŸคŸ๐Ÿป 3์ฃผ์ฐจ ๊ณผ์ œ Aug 14, 2023
@ena-isme ena-isme merged commit 54d4cc9 into main Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant