uiscrollview

UIScrollView ignores frameLayoutGuide constraints on iOS 12 when built with iOS 14.1 SDK

落爺英雄遲暮 提交于 2021-02-05 12:22:11
问题 I just wasted an hour with what looks like an iOS 14 SDK regression when running on iOS 12 so I thought i'd post this in case it helps others. Summary : When pinning the frame of the UIScrollView with the frameLayoutGuide as we've always done, this breaks on iOS 12 when the scrollview is contained within another view (in my case in a child viewcontroller, not sure if that matters). Setup : View setup, all views using autolayout: UIView "scrollviewContainerView" [fixed/unchanging size] | \-

UIScrollView with autolayout mixed approach?

…衆ロ難τιáo~ 提交于 2021-01-29 16:25:46
问题 I am trying to work an example code thats using the ' mixed approach ' mention on apple dev link: I am trying to stack 3 views vertically in UIScrollView. In below example the UIScrollView shows the red view on load but does not scroll as expected. I can scroll a little bit to see the green view below the red view - but the scroll view springs back up and does not scroll to the green view or view below it(blue view). I understand I need a constraint I tried to add one between view 1 & 2 so

UIScrollView draw ruler using drawRect

狂风中的少年 提交于 2021-01-29 10:48:49
问题 I am trying to draw a ruler on top of UIScrollView. The way I do it is by adding a custom view called RulerView. I add this rulerView to superview of scrollView setting its frame to be same as frame of scrollView. I then do custom drawing to draw lines as scrollView scrolls. But the drawing is not smooth, it stutters as I scroll and the end or begin line suddenly appears/disappears. What's wrong in my drawRect? class RulerView: UIView { public var contentOffset = CGFloat(0) { didSet { self

Why my WKWebview inside my UIScrollView is not displayed?

不问归期 提交于 2021-01-29 05:32:02
问题 I need to add a WKWebview to load web content, inside the content view of UIScrollView. I'm using the Apple code to load a web page, my outlet viewForWebview is linked correctly, and didFinish is called. class ViewController: UIViewController, WKUIDelegate, WKNavigationDelegate { var webView: WKWebView! @IBOutlet var viewForWebview: UIView! override func loadView() { super.loadView() let myConfiguration = WKWebViewConfiguration() webView = WKWebView(frame: .zero, configuration:

iOS: Custom top segmented control works as expected only when using debugger

懵懂的女人 提交于 2021-01-28 19:02:15
问题 I'm trying to create a custom top swipe menu that has a moving resizing orange bar that denotes which tab is selected. This is an extremely common design and I'm just doing this for practice as I am new to swift. You navigate by either swiping through the bottom collectionView or you can select a tab on the top menu. The top menu is also just a collectionView and is scrollable as well. As you can see below (first gif), my problem is that when I try to go back to the first tab, whether by

Reloading view after applying scale transform breaks frame of the UIScrollView inside it

梦想的初衷 提交于 2021-01-28 18:10:28
问题 I am using SpreadsheetView and trying to zoom into it using a pinch gesture and a scale transform. The view zooms fine but when I try to reload the data after it has been zoomed out, the frame of the view is much smaller than it should be. This is the snippet of code that handles the zooming of the view - @IBAction func handlePinch(recognizer : UIPinchGestureRecognizer) { if recognizer.state == .began { lastScale = Float(recognizer.scale) } if recognizer.state == .began || recognizer.state ==

UIScrollview resting at incorrect contentOffset (-20 px, not 0px)

半城伤御伤魂 提交于 2021-01-28 08:25:00
问题 I have a UIScrollview that expands in the y-axis and calls this delegate method: -(void)scrollViewDidScroll:(UIScrollView *)scrollView { float yOff = scrollView.contentOffset.y; NSLog(@"y off is %f", yOff); } As the scrollView is moved to the top (ie. yOff == 0), it actually comes to rest at -20px on most phones and -44px on the iPhoneX. How do I switch this behaviour off, and what are the risks of doing so? 回答1: Try setting contentInsetAdjustmentBehavior on your UIScrollView to .never if (

How to change UIScrollView Indicator color?

萝らか妹 提交于 2021-01-27 21:06:25
问题 When I use UIColor.blue its changing, but when I try to apply RGB, its not reflected in scrollview indicator. func scrollViewDidScroll(_ scrollView: UIScrollView) { let verticalIndicator: UIImageView = (scrollView.subviews[(scrollView.subviews.count - 1)] as! UIImageView) verticalIndicator.backgroundColor = UIColor(red: 211/255, green: 138/255, blue: 252/255, alpha: 1) // verticalIndicator.backgroundColor = UIColor.blue } 回答1: I think problem is here verticalIndicator.backgroundColor =

Xamarin Forms : How to fix Activity Indicator in Centre of Screen in Scrollview

老子叫甜甜 提交于 2021-01-27 07:03:51
问题 I have a ScrollView over AbsoluteLayout .. I need to Fix the postion of the ActivityIndicator in centre of screen. I tried following code. <ScrollView> <AbsoluteLayout VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"> <StackLayout BackgroundColor="White" Padding="50,20,50,20" Spacing="5" AbsoluteLayout.LayoutBounds="0,0,1,1" AbsoluteLayout.LayoutFlags="All"> // have set of elements.. </StackLayout> <ActivityIndicator IsVisible="{Binding IsBusy}" IsRunning="{Binding IsBusy}"

Xamarin Forms : How to fix Activity Indicator in Centre of Screen in Scrollview

巧了我就是萌 提交于 2021-01-27 07:01:39
问题 I have a ScrollView over AbsoluteLayout .. I need to Fix the postion of the ActivityIndicator in centre of screen. I tried following code. <ScrollView> <AbsoluteLayout VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"> <StackLayout BackgroundColor="White" Padding="50,20,50,20" Spacing="5" AbsoluteLayout.LayoutBounds="0,0,1,1" AbsoluteLayout.LayoutFlags="All"> // have set of elements.. </StackLayout> <ActivityIndicator IsVisible="{Binding IsBusy}" IsRunning="{Binding IsBusy}"