nsviewcontroller

Force refresh on another ViewController component with swift

旧时模样 提交于 2019-12-11 01:10:43
问题 I'm trying to pass a trigger between 2 view controller but i can't find something that works ... I have the main controller with a NSTableView, source linked, View Base. main Controller class : class ViewController: NSViewController { I have an array defined in Global variables. on the viewDidLoad i add 2 elements in my array, then i use setDelegate and setDataSource. It works fine. myLib.myCoins = fillCoinsTable() print ("My lib has \(myLib.myCoins.count) objects ") mainCoinTable.setDelegate

Control a NSTabViewController from parent View

a 夏天 提交于 2019-12-10 18:35:20
问题 (I'm using storyboards and swift.) I currently have a NSWindowController which has a NSTabViewController as contentViewController. I am now trying to change the Tabs from the NSWindowController via code using let tabController = self.contentViewController as! NSTabViewController tabController.tabView.selectTabViewItemAtIndex(1) but the TabView doesn't change the view. Am I using the API wrong? 回答1: I found an forum post about this topic. There seems to be a bug when setting the tabView index

Access an IBOutlet from another class in Swift

爱⌒轻易说出口 提交于 2019-12-10 16:36:57
问题 I'm new to Swift and Mac App. So I'm writing an Mac App today and I still confuse how to access an IBOutlet from another class after searching a lot. I'm using StoryBoard and there are two NSTextField path mirror in my ViewController. I have created a custom class Path.swift for the first NSTextField path to know when the text in path has changed. class Path: NSTextField, NSTextFieldDelegate { override func drawRect(dirtyRect: NSRect) { super.drawRect(dirtyRect) // Drawing code here. self

Add lots of views to NSScrollView

北慕城南 提交于 2019-12-10 10:59:07
问题 I'm trying to add one subview (view from an NSViewController ) for every element in a dictionary to a NSScrollView to get kind of a tableview, but with much more flexibility over the cells. Is it possible to place (programmatically) e.g. 100 subviews underneath each other so that you have to scroll down the NSScrollView to get to the last element??? Thanks in advanced, Grolior 回答1: The short answer is yes. I have done this before, and I assure you that it will work. Let me also assure you

OS X addsubview from xib in swift

旧城冷巷雨未停 提交于 2019-12-09 23:18:02
问题 I'm trying to add a new sub view form a nib using swift for OS X. So far i've: created a new "Cocoa Application" added a new "Cocoa Class" called "TestSubView" as a subclass of NSViewController with a XIB file I want to add this subview to my main view when the application loads. in my ViewController ( the ViewController for the main window ) i have. import Cocoa class ViewController: NSViewController { override func viewDidLoad() { super.viewDidLoad() let newSubView = TestSubView(); self

how do I get WKWebView to work in swift and for an macOS App [duplicate]

[亡魂溺海] 提交于 2019-12-08 19:13:57
问题 This question already has answers here : Transport security has blocked a cleartext HTTP (25 answers) Closed 2 years ago . before this get's shot down for being a duplicate, it isn't. Pretty much every question on WKWebView here is about WKWebView in iOS Apps, not macOS Apps, with the difference being pretty much just the UIViewController interface being implemented instead of the NSViewController interface in macOS. The example code in Apple's Documentation as well as the Controller code,

How to do collapse and expand view in mac application?

橙三吉。 提交于 2019-12-08 07:21:05
问题 I am new to mac application development, here i want to do expand and collapse view in my custom view(NSView) here the sample image How can i achieve these kind of collapse and expand cell in NSViewController not in NSWindow... Is it possible using NSTableView? I know its a simple question but i facing problem. Please suggest me some sample code or links.. Thanks 回答1: Collapsing / expanding can be implemented by adjusting auto layout constraints in the action method of the disclosure triangle

How to make child controls of view will get focus on Tab and Shift+Tab in NSViewController

。_饼干妹妹 提交于 2019-12-08 05:59:44
问题 I have to upgrade one existing application and neeed to split its existing UI into separate NIBs. I have planning to start with creating separate NIBs and NSViewController for all my splitted UIs. Now the problem is my NSViewController didn't respond on keyboard TAB and SHFIT+TAB events, I simply wants my NSViewController to set focus on appropriate child control in my dynamically loaded NSViewController view when user click TAB or SHIFT+TAB. Thanks, EDITED : Following is my requirement. I

How to constrain second NSViewController minimum size in OS X app?

…衆ロ難τιáo~ 提交于 2019-12-08 05:47:18
问题 I am a novice Mac OS X developer. I assume this is an easy question, but I haven't been able to find any useful results via searches. How do I constrain the size of a SECOND view controller? I started with a simple Mac OS X app, with a single View Controller. I can select the window that contains the View Controller, then select the "Size Inspector" and check the "Minimum Content Size" box, and specify a minimum x and y for the window. This allows me to specify the minimum size for this first

How to make child controls of view will get focus on Tab and Shift+Tab in NSViewController

核能气质少年 提交于 2019-12-07 23:15:31
I have to upgrade one existing application and neeed to split its existing UI into separate NIBs. I have planning to start with creating separate NIBs and NSViewController for all my splitted UIs. Now the problem is my NSViewController didn't respond on keyboard TAB and SHFIT+TAB events, I simply wants my NSViewController to set focus on appropriate child control in my dynamically loaded NSViewController view when user click TAB or SHIFT+TAB. Thanks, EDITED : Following is my requirement. I have three sub views which i need to load dynamically and switch using NSPopupButton in my MainWindow