Open keyvan1361 opened 5 years ago
Hi,
may be you did this in viewDidLoad()
, try viewDidAppear()
Hi,
may be you did this in
viewDidLoad()
, tryviewDidAppear()
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!
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
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 )