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

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

Related

iOS Charts Disable Zoom

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

how to make button placed on top of UICollectionView react to the tap?

UICollectionView which behaves as a gallery
gallery.showsHorizontalScrollIndicator = false
gallery.isPagingEnabled = true
is placed inside UIView container and on this container, custom button (favorite image button) is added:
galleryContainer.addSubview(gallery)
galleryContainer.addSubview(pageControl)
...
galleryContainer.addSubview(favBtn)
favBtn.topAnchor.constraint(equalTo: galleryContainer.topAnchor, constant: 40).isActive = true
favBtn.trailingAnchor.constraint(equalTo: galleryContainer.trailingAnchor, constant: -30).isActive = true
favBtn.heightAnchor.constraint(equalToConstant: 30).isActive = true
favBtn.widthAnchor.constraint(equalToConstant: 30).isActive = true
The problem is that the favorite button does not react on the tap, why, and how can this be fixed? I tried favBtn.becomeFirstResponder() but without any success.
Bring your button to the front and enable interact
galleryContainer.bringSubview(toFront: favBtn)
favBtn.isUserInteractionEnabled = true
The reason for the issue was that button overlapped the top navigation bar which had isTranslucent = true property. Once I managed to move the button beyond the navigation bar it became active.

Horizontal Bar chart Swift

I want it like this:
But what I can do is, how to get rid of little red label:
Core code for the chart:
var barchart = [BarChartDataEntry]()
// some values
barchart.append(value1)
barchart.append(value2)
barchart.append(value3)
let barData = BarChartDataSet(values: barchart, label: "")
barData.colors = [NSUIColor.red]
let data = BarChartData(dataSet: barData)
data.barWidth = 0.35
cell.barChart.data = data
cell.barChart.scaleYEnabled = false
cell.barChart.chartDescription?.text = ""
cell.barChart.scaleXEnabled = false
cell.barChart.pinchZoomEnabled = false
cell.barChart.doubleTapToZoomEnabled = false
cell.barChart.rightAxis.enabled = false
cell.barChart.xAxis.drawGridLinesEnabled = false
cell.barChart.leftAxis.drawGridLinesEnabled = false
cell.barChart.leftAxis.drawAxisLineEnabled = false
cell.barChart.xAxis.drawAxisLineEnabled = false
cell.barChart.xAxis.drawLabelsEnabled = false
cell.barChart.leftAxis.drawLabelsEnabled = false
cell.barChart.animate(yAxisDuration: 1.5, easingOption: .easeInOutQuart)
return cell
I would like to set max value and make labels rounded as in the image above. I am using https://github.com/danielgindi/Charts.
You can implement the similar UI by using the UIProgressView
First, you can set the Label on top, then a UIProgressView and repeat the same. For other two progresses.
You can add the proper constraints and achieve it.
Refer this Sample Demo for achieving the same.
Hope it helps.
Just add this line where you are setting chartView
cell.barChart.legend.enabled = false
It works for me.
Use UIProgressView component in storyboard and create the outlet
#IBOutlet var progressViewWalk: UIProgressView!
You can set the required progress by:-
progressViewWalk.progress = Float(YOURValue)/100
Set your required Track tint color Progress tint color in Attribute Inspector.

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

Resources