Friday, 27 October 2017
Tuesday, 24 October 2017
Cmd + click, jumping to definition in Xcode 9 issue?
If cmd+click is not working in Xcode 9, here is the solution
Xcode9-Preferences->Navigation->Command-click on Code:->Jump To Definition
if still not found
Xcode9-Preferences->Navigation->Command-click on Code:->Jump To Definition
if still not found
- File > Workspace Settings
- Click over the little grey arrow above Advanced... Button (Derived Data)
- Select my project folder and delete it.
- close the xcode and reopen clean and build
Monday, 16 October 2017
Call the event continuously on editing of Textfield
override func viewDidLoad() {
super.viewDidLoad()
textField.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged)
}
func textFieldDidChange(_ textField: UITextField) {
print("event triggered")
}
Saturday, 14 October 2017
Dashed line borders for UIView
var yourViewBorder = CAShapeLayer()
yourViewBorder.strokeColor = UIColor.black.cgColor
yourViewBorder.lineDashPattern = [2, 2]
yourViewBorder.frame = yourView.bounds
yourViewBorder.fillColor = nil
yourViewBorder.path = UIBezierPath(rect: yourView.bounds).cgPath
yourView.layer.addSublayer(yourViewBorder)
Wednesday, 11 October 2017
Set cornerRadius separately bottom-left,bottom-right and top-left,top-right corner of a UIView?
extension UIView {
func roundCorners(corners:UIRectCorner, radius: CGFloat) {
let path = UIBezierPath(roundedRect: self.bounds, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius))
let mask = CAShapeLayer()
mask.path = path.cgPath
self.layer.mask = mask
}
}
usage:
YourView.roundCorners([.topLeft, .bottomLeft], radius: 10)
func roundCorners(corners:UIRectCorner, radius: CGFloat) {
let path = UIBezierPath(roundedRect: self.bounds, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius))
let mask = CAShapeLayer()
mask.path = path.cgPath
self.layer.mask = mask
}
}
usage:
YourView.roundCorners([.topLeft, .bottomLeft], radius: 10)
Subscribe to:
Posts (Atom)
Remove bottom line in navigation bar
navigationController ?. navigationBar . setBackgroundImage ( UIImage (), for: . any , barMetrics: . default ) navigat...
-
--> Use this line for getting device name UIDevice.current.name ------------------------------------------------------------------...
-
For Label: labelname.attributedText = NSAttributedString(string: "text " , attributes: [NSUnderlineStyleAttribut...
-
// Reading data from Local Json file instead of Service urls using Alamofire in swift3 func getwordmeaningdata() { ...