cocoa

Why is [[NSScrollView documentView] scrollPoint:] not working in loadView method?

房东的猫 提交于 2020-01-16 18:06:08
问题 I am trying to automatically scroll to the far right side of a horizontal imagebrowser in the loadView method of the view controller that contains the browser. It doesn't work when I try to do this (just scrolling to x=1000 as a test): - (void)loadView { [super loadView]; // Set initial position [[[self scrollView] documentView] scrollPoint:NSMakePoint(1000.0, 0.0)]; } But at some point in the course of debugging I found that this works: - (void)loadView { [super loadView]; // Set initial

Why is [[NSScrollView documentView] scrollPoint:] not working in loadView method?

被刻印的时光 ゝ 提交于 2020-01-16 18:04:13
问题 I am trying to automatically scroll to the far right side of a horizontal imagebrowser in the loadView method of the view controller that contains the browser. It doesn't work when I try to do this (just scrolling to x=1000 as a test): - (void)loadView { [super loadView]; // Set initial position [[[self scrollView] documentView] scrollPoint:NSMakePoint(1000.0, 0.0)]; } But at some point in the course of debugging I found that this works: - (void)loadView { [super loadView]; // Set initial

Debug/Run in Xcode stopped working. Executable settings are wrong and can't be fixed too

旧时模样 提交于 2020-01-16 18:03:47
问题 I've just had a strange problem show up with my XCode project. The project is one that I've been working on for 4+ years. Just today, when try to start debugging, the debugging view opens and the console says "[Session started at 2010-10-03 14:04:35 -0600.]" but nothing else happens. It seems that the executable is screwed up. If I open up the executable's (I've only got one in the project) settings window, in the General tab, the drop down for "Use whatever for standard input/output" says

Cocoa View Controller Scene issue

北慕城南 提交于 2020-01-16 12:24:16
问题 I have 2 View Controller Scenes. Scene2 holds settings that will be used in scene1. Scene2 is accessed by menu item and its presented as show. Now the issue is that the settings used in scene2 will not be used by scene1 unless the latter is refreshed. I did try to trigger a viewDidLoad() of scene1 when the settings were saved at scene2 but it crashed. class replaceSegue: NSStoryboardSegue { override func perform() { if let fromViewController = sourceController as? NSViewController { if let

Cocoa View Controller Scene issue

萝らか妹 提交于 2020-01-16 12:22:08
问题 I have 2 View Controller Scenes. Scene2 holds settings that will be used in scene1. Scene2 is accessed by menu item and its presented as show. Now the issue is that the settings used in scene2 will not be used by scene1 unless the latter is refreshed. I did try to trigger a viewDidLoad() of scene1 when the settings were saved at scene2 but it crashed. class replaceSegue: NSStoryboardSegue { override func perform() { if let fromViewController = sourceController as? NSViewController { if let

How to loop through subviews in order to get the text of NSTextViews

半城伤御伤魂 提交于 2020-01-16 11:56:58
问题 I have a NSView which contains several instances of NSTextView. I would like to get the content (string) of each instance. So far, I have this (this code does not compile) : for(NSView *view in [self subviews]) { NSLog(@"class: %@ ", [view className]); if([view isKindOfClass:[NSTextView class]]) NSLog(@"[view string] %@",[view string]);} At this point, I expect to be able to send the string message to view which is an instance of NSTextView, but: Error message: No visible @interface for

How to remove the white box around the NSButton checkbox when disabled?

末鹿安然 提交于 2020-01-16 08:43:34
问题 There is not much code to this. Adding a NSButton with Style Check and Type Switch into IB. In IB it looks fine. But starting the app there is a white box appearing around the disabled checkbox. The background is obviously grey hence it shows. Is there a way to remove/override that? 来源: https://stackoverflow.com/questions/59672767/how-to-remove-the-white-box-around-the-nsbutton-checkbox-when-disabled

Followup to returning nil from a [[class alloc] init]

主宰稳场 提交于 2020-01-16 04:42:26
问题 As follow-up of sorts to Is returning nil from a [[class alloc] init] considered good practice?, there's a case that I haven't seen any discussed much: what to do with an init that fails some preconditions before it can call the next init? Example, suppose in this initWithStuff: method being passed nil or in general having no value to pass to initWithValue: is an absolute failure and we definitely want to return nil. - (id)initWithStuff:(Stuff *)inStuff { if (!inStuff || ![inStuff

How to detect users’ freehand drawing to primitive geometrical objects like square, circle, triangle [closed]

爱⌒轻易说出口 提交于 2020-01-16 04:22:07
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago . I am currently looking for some guide/samples on how to implement the OS X Yosemite’s markup like features. i.e., auto detecting/guess freehand drawing to match users’ intention of whether they are trying to draw circle, square, or triangle. Please refer the image below, the left

NSApplication init failure: Creating more than one Application

元气小坏坏 提交于 2020-01-16 04:14:26
问题 I am working with the document architecture in Cocoa but will create my own window instead of a nib. I am replacing NSApplicationMain with code that has worked for apps not using the document architecture. int main(int argc, const char * argv[]) { @autoreleasepool { NSApplication *app = [[NSApplication alloc] init]; AppDelegate *appDelegate = [[AppDelegate alloc] init]; [app setDelegate:appDelegate]; [app run]; } } But with the document architecture, when I create a window (I know this is not