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

scroll screen size problem #136

Open
keyvan1361 opened this issue Aug 28, 2019 · 2 comments
Open

scroll screen size problem #136

keyvan1361 opened this issue Aug 28, 2019 · 2 comments

Comments

@keyvan1361
Copy link

keyvan1361 commented Aug 28, 2019

Report

i have replaced the contenview in the example with my own viewCotrollers
it works fine when the app loads and i change the tabs but when i click on the menu items
the screen width is wrong and it does not scroll to the end!
it works fine on iphone xs but in larger screen sizes like iphone xs
Screen Shot 2019-08-28 at 22 28 26
plus or ipad the size is wrong when the menu is clicked

when i change
self?.scrollView.frame.width
to
UIScreen.main.bounds.width
it makes the tab size better but with a padding on the sides

segmentioView.valueDidChange = { [weak self] _, segmentIndex in let contentOffsetX = UIScreen.main.bounds.width * CGFloat(segmentIndex) changed:",self!.segmentioView.selectedSegmentioIndex) self?.scrollView.setContentOffset( CGPoint(x: contentOffsetX, y: 0), animated: true ) segmentioView.valueDidChange = { [weak self] _, segmentIndex in let contentOffsetX = UIScreen.main.bounds.width * CGFloat(segmentIndex) self?.scrollView.setContentOffset( CGPoint(x: contentOffsetX, y: 0), animated: true )

@AlexanderYem
Copy link

Hi,

may be you did this in viewDidLoad(), try viewDidAppear()

@keyvan1361
Copy link
Author

keyvan1361 commented Sep 16, 2019

Hi,

may be you did this in viewDidLoad(), try viewDidAppear()

hi
i moved the code from viewwillappear to viewDidAppear
but still the same problem in containerVc(exampleViewController)
maybe it's a constraint problem
there is a problem with contentOffsetX!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants