I change the text of a label dynamically (so I do not know the text of the label) how can I animate the size to fit. I am looking for a smooth, elegant transition for design purposes.
What I have tried:
NSAnimationContext.runAnimationGroup({ (context) in
context.duration = 4.0
label1.stringValue = "long, long text"
label1.animator().sizeToFit()
})
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
How to make a link when I click to a button in macOS?
This works well in iOS. How to do the same with macOS:
@IBAction func button1(_ sender: UIButton) {
if let url = URL(string: "some link") {
UIApplication.shared.open(url)
}
}
macOS, Swift, storyboards
How can I make the window active in all spaces?
I could find how to do that with storyboard: Select the window > Attributes > Spaces > Can join all spaces. How can I do the same with code (activate and de-activate)
macOS, SwiftIs it possible to remove the scroll in WebKit View? (or make it not visible)I have a WebKit View from library and I have made the connection to the ViewController.swift:@IBOutlet weak var webView1: WKWebView!
(macOS, Swift, storyboards)Can I change a label on hover?WHAT I HAVE TRIED1- I have put a button in storyboard and make it transparent. It works if I click, but I could nof find how to if hover@IBOutlet weak var label1: NSTextField!@IBAction func button1(_ sender: NSButton) { label1.textColor = NSColor.gray}2- I have put a NSView and drag a NSClickGestureRecognizer to it. Again, it works on click but I cannot find a way to do it with hover@IBOutlet weak var label2: NSTextField!@IBAction func gestureRecognizer1(_ sender: NSClickGestureRecognizer) { label2.textColor = NSColor.gray}I could find something in Apple documentation. But it talks about UIButton. I cannot find a way to adapt to my case:https://developer.apple.com/documentation/uikit/uihovergesturerecognizer