cocoa

NSOutlineView row not editable by “Return” key anymore after reloading a different table view cell

◇◆丶佛笑我妖孽 提交于 2021-02-05 08:11:32
问题 I'm running into the strangest issue with my NSOutlineView : Everything is set up in a storyboard, i.e. the outline view and two NSTableCellView s The two cell views are mostly the same, only one shows an icon, the other one doesn't I can begin editing an item (row) by pressing the Return key, i.e. the NSTextField that is part of my NSTableCellView enters into edit mode. This is the default behavior and works fine so far. However: After editing ends and the item was changed, I use the second

NSTableView in NSScrollView doesn't autoscroll when dragging

半世苍凉 提交于 2021-02-04 19:46:25
问题 I'm currently implementing drag and drop rearranging in a table view in my OS X app. While normal scrolling works fine, autoscroll while dragging it totally broken. If I grab a cell and start dragging, autoscroll just tells the table to scroll to the top. If I manually scroll using the trackpad during dragging the table continually pops to the top. If I drag one of the top cells, the table will not autoscroll down when dragging near the bottom. I subclassed NSScrollView and overrode the

End Editing on NSTableView (View Based)

拥有回忆 提交于 2021-02-04 16:12:06
问题 When a user is mid-editing a textfield on a tableview and decides to click the close button for the window, the changes he/she made does not get saved. How can I force a tableview (view based) to end editing (not abort editing) ? 回答1: The simplest way to do this is to assign a delegate for your window and respond to NSWindow 's -windowShouldClose: delegate method. In it, invoke -makeFirstResponder: to make the window itself the first responder, noting the BOOL answer it gives. You should

Expanding all items of a NSOutlineView that loads data from a data source

Deadly 提交于 2021-02-04 12:40:08
问题 First of all I'm new to cocoa development so I suppose I'm probably trying to do this the wrong way, but here goes: I have a NSOutlineView which loads the data from a NSOutlineViewDataSource implementation. I want all the items to be expanded after they are loaded, but i can't seem to find an event fired when the data has finished loading, so I can send a [outlineView expandItem: nil expandChildren: YES] to it. I looked into the NSOutlineViewDelegate protocol but I was unable to find a

Xcode - How to fix 'NSUnknownKeyException', reason: … this class is not key value coding-compliant for the key X" error?

*爱你&永不变心* 提交于 2021-01-29 22:56:05
问题 I'm trying to link a UILabel with an IBOutlet created in my class. My application is crashing with the following error. What does this mean? How can I fix it? *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x6e36ae0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key XXX.' 回答1: Your view controller may have the wrong class in your xib. I downloaded your project. The error you are getting is

Xcode - How to fix 'NSUnknownKeyException', reason: … this class is not key value coding-compliant for the key X" error?

☆樱花仙子☆ 提交于 2021-01-29 22:55:13
问题 I'm trying to link a UILabel with an IBOutlet created in my class. My application is crashing with the following error. What does this mean? How can I fix it? *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x6e36ae0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key XXX.' 回答1: Your view controller may have the wrong class in your xib. I downloaded your project. The error you are getting is

Xcode - How to fix 'NSUnknownKeyException', reason: … this class is not key value coding-compliant for the key X" error?

…衆ロ難τιáo~ 提交于 2021-01-29 22:52:51
问题 I'm trying to link a UILabel with an IBOutlet created in my class. My application is crashing with the following error. What does this mean? How can I fix it? *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x6e36ae0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key XXX.' 回答1: Your view controller may have the wrong class in your xib. I downloaded your project. The error you are getting is

Xcode - How to fix 'NSUnknownKeyException', reason: … this class is not key value coding-compliant for the key X" error?

♀尐吖头ヾ 提交于 2021-01-29 22:52:34
问题 I'm trying to link a UILabel with an IBOutlet created in my class. My application is crashing with the following error. What does this mean? How can I fix it? *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x6e36ae0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key XXX.' 回答1: Your view controller may have the wrong class in your xib. I downloaded your project. The error you are getting is

How to rotate text in NSView? (Mac OS, Cocoa, Swift)

僤鯓⒐⒋嵵緔 提交于 2021-01-29 20:51:59
问题 I am new to Cocoa/Swift applications for Mac OS 10.11 (Not iOS). I created an NSView with the size of A4 paper, drew some simple lines and some text using NSString.drawAtPoint within drawRect() . So far it works. However, from time to time, I need a few characters to be turned 90 degrees, and some text needs to be scaled at X, or Y direction. That is where I don't know how to do it. Please can someone tell me how to achieve these? Many thanks. 回答1: You can use NSAffineTransform . This code

How to move or resize an NSView by setting the frame property?

旧巷老猫 提交于 2021-01-29 20:42:05
问题 I created the NSView in a storyboard. In this case, it is an NSTextField . In the NSViewController 's viewDidLoad() method, I want to conditionally resize and reposition the NSTextField , but setting the frame has no effect. For example: class ViewController: NSViewController { @IBOutlet var label: NSTextField! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. label.frame = NSRect(x: 0, y: 0, width: 200, height: 17) label.setNeedsDisplay() }