Post

Replies

Boosts

Views

Activity

Quick Help always stops working after debugging
I have an annoying problem with Xcode 14.2. After opening a project, Quick Help pane works normally. But once a debugging session ends, it stops working (showing nothing). Meanwhile ALT+CLICK won't work either (no response). After closing and re-opening the project Quick Help works again. Is there any workaround for this nuiance? I already went back to 13.14.1.
1
0
312
Apr ’23
How can I know when an NSTextField gets input focus (first responder)?
I think I can do this by creating a custom view overriding the following 2 methods: @implementation MyTextField - (BOOL)becomeFirstResponder { NSLog(@"%s: %@", __func__, self); return [super becomeFirstResponder]; //return YES; } - (BOOL)resignFirstResponder { NSLog(@"%s: %@", __func__, self); return [super resignFirstResponder]; //return YES; } @end But there is a gotcha - I always get successive become/resign. That is when I get becomeFirstResponder, I also get resignFirstResponder immediately. Note - I only have one MyTextField instance on my window. Is there another safe way to achieve my goal?
1
0
759
Mar ’23
KVO addObserver:forKeyPath not working
This is the first time I use KVO pattern. The code is quite simple but I could not get it working - the log method never gets run. What's wrong with my code? @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; [self.view.window addObserver:self forKeyPath:@"firstResponder" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld context:nil]; } - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context { NSLog(@"%@", change); } @end
1
0
665
Mar ’23
Need a (simple) algorithm to tell if 2 images differ
I have a need to tell if 2 images are different by unimportant details. For example, one image is only slightly different than another because: *) It is a little stretched *) or it has 99% portion of another (only missing some pixels on borders) I wonder if there is an efficient algorithm to achieve my goal. Any suggestions are welcome.
3
0
2.3k
Mar ’23
NSView and dynamically created subviews
I have a custom view that acts as a container for many NSImageViews that will be created dynamically on the fly. When the container view is resized (by parent window), some new subviews may be created and added to the container view, or some subviews may be removed because they are not fit into a smaller view. I have two ways to handle the 'disappearing' subviews. One way is to hide them, the other is to remove them from the container view. My concern is that - Is there a (big) performance difference between the two methods? Which is better?
Topic: UI Frameworks SubTopic: AppKit Tags:
0
0
432
Mar ’23
Strange debug output with command line gcc
When I log in and start a Terminal window, a simple gcc command produces the following debug messages: 2022-07-15 13:52:41.470 xcodebuild[784:10833] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore 2022-07-15 13:52:41.470 xcodebuild[784:10833] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore Subsequent invoke of gcc does not produce these messages. How to avoid this small nuisance?
1
0
633
Jul ’22
Quick Help always stops working after debugging
I have an annoying problem with Xcode 14.2. After opening a project, Quick Help pane works normally. But once a debugging session ends, it stops working (showing nothing). Meanwhile ALT+CLICK won't work either (no response). After closing and re-opening the project Quick Help works again. Is there any workaround for this nuiance? I already went back to 13.14.1.
Replies
1
Boosts
0
Views
312
Activity
Apr ’23
chevron.down.square.fill image name
I cannot find any docs on this image name but I can select it from the dropdown list in IB. What is the mim macOS version for this name?
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
4
Boosts
0
Views
1.2k
Activity
Mar ’23
How can I know when an NSTextField gets input focus (first responder)?
I think I can do this by creating a custom view overriding the following 2 methods: @implementation MyTextField - (BOOL)becomeFirstResponder { NSLog(@"%s: %@", __func__, self); return [super becomeFirstResponder]; //return YES; } - (BOOL)resignFirstResponder { NSLog(@"%s: %@", __func__, self); return [super resignFirstResponder]; //return YES; } @end But there is a gotcha - I always get successive become/resign. That is when I get becomeFirstResponder, I also get resignFirstResponder immediately. Note - I only have one MyTextField instance on my window. Is there another safe way to achieve my goal?
Replies
1
Boosts
0
Views
759
Activity
Mar ’23
KVO addObserver:forKeyPath not working
This is the first time I use KVO pattern. The code is quite simple but I could not get it working - the log method never gets run. What's wrong with my code? @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; [self.view.window addObserver:self forKeyPath:@"firstResponder" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld context:nil]; } - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context { NSLog(@"%@", change); } @end
Replies
1
Boosts
0
Views
665
Activity
Mar ’23
Which version of Xcode works best with macOS 12 (Monterey)?
I am currently using Xcode 14.2 (14C18), but it has some glitches (which I don't want to enumerate here). I now want to revert back to an earlier older version. Any suggestions?
Replies
4
Boosts
0
Views
1.6k
Activity
Mar ’23
An audacious idea - how implement the overlay like NSDatePicker?
I really like to implement an overlay that is similar with what we have in NSDatePicker: I know most of the time, we just use what Apple gives us behind the curtain, but I really want to know if this even possible. Thanks!
Replies
0
Boosts
0
Views
427
Activity
Mar ’23
How "Show in Finder" works in Xcode?
I want to add "Show in Finder" in my app that is similar to the one in Xcode. How do I do this using objc?
Replies
3
Boosts
0
Views
660
Activity
Mar ’23
How do I control popover invoked by segue?
In IB I connect a button to a VC and set the segue kind to 'Popover'. Now I have a problem. How do I get the NSPopover and its delegate? -(void)prepareForSegue:(NSStoryboardSegue *)segue sender:(id)sender {     NSLog(@"%s: %@", __func__, segue.destinationController);     NSViewController* vc = segue.destinationController; }
Replies
3
Boosts
0
Views
672
Activity
Mar ’23
Add XIB custom view as a subview of another view in Interface Builder
I am aware of the following approach: Add a custom view into a view in IB. Set the class of this custom view, say "MyDatePickerView". Now my datepicker view has a moderate complex UI, and I want to isolate its functionalities into a standalone XIB. Is it possible to do this in IB (I know I can do it in code)?
Replies
0
Boosts
0
Views
496
Activity
Mar ’23
NSObject isEqual: vs isEqualTo:
Got confused about these 2 methods. NSObject protocol has an isEqual: method. NSObject implements NSObject protocol but it does not have isEqual:, instead it has an isEqualTo: method. What's the magic behind the design? Or is the doc wrong? Should I implement both methods in a derived class?
Replies
1
Boosts
0
Views
844
Activity
Mar ’23
Need a (simple) algorithm to tell if 2 images differ
I have a need to tell if 2 images are different by unimportant details. For example, one image is only slightly different than another because: *) It is a little stretched *) or it has 99% portion of another (only missing some pixels on borders) I wonder if there is an efficient algorithm to achieve my goal. Any suggestions are welcome.
Replies
3
Boosts
0
Views
2.3k
Activity
Mar ’23
How create thumbnail from NSImage?
I did searches on the Internet but could not find a definitive answer. The best thing I get is CGImageSourceCreateThumbnailAtIndex API function. But I don't know how create CGImageSource out of an NSImage object. Thanks for any suggestions.
Replies
0
Boosts
0
Views
724
Activity
Mar ’23
NSView and dynamically created subviews
I have a custom view that acts as a container for many NSImageViews that will be created dynamically on the fly. When the container view is resized (by parent window), some new subviews may be created and added to the container view, or some subviews may be removed because they are not fit into a smaller view. I have two ways to handle the 'disappearing' subviews. One way is to hide them, the other is to remove them from the container view. My concern is that - Is there a (big) performance difference between the two methods? Which is better?
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
0
Boosts
0
Views
432
Activity
Mar ’23
App running shell script question
I want to use NSTask to run a shell script that resides in Resouces directory. The script performs some operations on files in the app's Data directory.But I am concerned that Apple could refuse my app for some reasons. Can anyone confirm if this approach is safe. Thanks.
Replies
7
Boosts
0
Views
5.5k
Activity
Jan ’23
Strange debug output with command line gcc
When I log in and start a Terminal window, a simple gcc command produces the following debug messages: 2022-07-15 13:52:41.470 xcodebuild[784:10833] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore 2022-07-15 13:52:41.470 xcodebuild[784:10833] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore Subsequent invoke of gcc does not produce these messages. How to avoid this small nuisance?
Replies
1
Boosts
0
Views
633
Activity
Jul ’22