iOS Charts Disable Zoom - ios

How do you disable zoom for iOS Charts but not completely stop user interaction? For example, still using the highlight tap. This takes care of the zoom, but it disables everything else as well.
chartView.userInteractionEnabled = false

To disable zoom, but not impact other chart interaction, make these adjustments:
chartView.doubleTapToZoomEnabled = false
chartView.pinchZoomEnabled = false
chartView.scaleXEnabled = false
chartView.scaleYEnabled = false

Related

How do I disable the bounces effect of wkewbview in iOS 14

WKWebView. ScrollerView. Bounces = false
ios12 works but in ios14 doesn't work, how can I solve
These worked for me,try
webView.scrollView.alwaysBounceHorizontal = false
webView.scrollView.alwaysBounceVertical = false
webView.scrollView.bounces = false

How to disable gestures (lock - no move/pan/zoom) on mapView - here maps ios sdk/swift 3?

How to Disable mapView gestures on iOS?
On Android:
mapFragment.getMapGesture().setAllGesturesEnabled(false);
Just disable user interaction...
mapView.isUserInteractionEnabled = false
For anyone looking to disable movement of the gms map while still being able to add custom gesture recognizers, you can use the following code for Swift 4.1
gmsMapView.settings.tiltGestures = false
gmsMapView.settings.rotateGestures = false
gmsMapView.settings.zoomGestures = false
gmsMapView.settings.scrollGestures = false`
The key is to disable zooms and scrolls, such as:
mapView.isUserInteractionEnabled = false
This is Enough.
In the latest SDK, you can switch off gestures:
mapView.settings.setAllGesturesEnabled(false)

How to disable the cross and other touch events in ios-charts?

i have a Line Chart view in my iOS app.
#IBOutlet weak var lineChartView: LineChartView!
the zooming and touching is enabled. I do not let the user do anything in the chart, even selecting is not allowed.
I tried:
self.lineChartView.pinchZoomEnabled = false
self.lineChartView.dragEnabled = false
self.lineChartView.dragDecelerationEnabled = false
but without any luck. I can still touch the graph and see the cross. I even can pinch to zoom the graph.
How can i turn this behaviour off?+
Doh!
in storyboard I can disable "User Interaction Enabled".
that do the trick.
The accepted solution didn't work for my barChartView for some reason.
Instead, setting barChartView.isUserInteractionEnabled = false did the trick.
So, for the OP, the following should work self.lineChartView.isUserInteractionEnabled = false
In case anyone would like it to still drag but only disable zooming, you can try
self.lineChart.setScaleEnabled(false)
I just used
dataSet.highlightColor = .clear
If you want to still have the interactive chart Try these:
chartView.dragXEnabled = false
chartView.dragYEnabled = false
chartView.scaleXEnabled = false
chartView.scaleYEnabled = false

Why UIButton Automatically change imageView.hidden = false

This is part of my code, in which I add a subview to an UIButton.
self.imageView?.hidden = true
guard self.subviews.contains(frequencyView) else {
print("show frequency view\(self.imageView?.hidden)")
self.addSubview(frequencyView)
print("show frequency view\(self.imageView?.hidden)")
self.imageView?.hidden = true
print("show frequency view\(self.imageView?.hidden)")
return
}
However I when I set the button's imageView.hidden = true before I addSubview. It'll automatically change the hidden state to false.
show frequency viewOptional(true)
show frequency viewOptional(false)
show frequency viewOptional(true)
Is there any method that can prevent it from happening? or do I have to change it back to true after that.

How to lock the scroll view in place?

I want to lock the scrollView when my segmented Control comes to top of the screen. How can I do this in swift? What's the code of this? How to compute the distance between the top of the segmented control and top of the view controller? It means how can I find the true place for locking scrollView?
After Swift 4.0 it has changed to
scrollView.isScrollEnabled = false
and
scrollView?.isScrollEnabled = true
Just flip the scrollEnabled boolean:
yourScrollView.scrollEnabled = false
To make it scroll again:
yourScrollView.scrollEnabled = true

Resources