This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//To set UISlider height, (which is by default not provided by UIKit framework) | |
//Steps: | |
//1. Add "CustomSlider" class in your swift file. | |
//2. Set "CustomSlider" class name into UISlider control from interface builder. | |
//3. Set "trackLineHeight" value as per requirment. | |
class CustomSlider: UISlider { | |
//Set line height value from Interface Builder,i.e. here ten is default value | |
@IBInspectable var trackLineHeight: CGFloat = 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This is code to change font size and avoid text copy functionality from entire html in UIWebView | |
//"textSize" : this is integer variable which you want to set font size | |
func webViewDidFinishLoad(_ webView: UIWebView) { | |
if (webView.stringByEvaluatingJavaScript(from: "document.readyState") == "complete") { | |
//Avoid to detect touch gesture for disable user selection | |
webView.stringByEvaluatingJavaScript(from: "document.documentElement.style.webkitUserSelect='none';") | |
webView.stringByEvaluatingJavaScript(from: "document.documentElement.style.webkitTouchCallout='none';") | |
//Set font size | |
let jsString = "document.getElementsByTagName('body')[0].style.fontSize='\(textSize)px'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class ViewController: UIViewController, UITextFieldDelegate { | |
//MARK: - Variables | |
var activeField: UITextField? | |
//--------------------------------- | |
//MARK: - IBOutlets | |
@IBOutlet weak var firstTextField: UITextField! |