Is there way I can quickly set up an About Window for my OS X app without creating a window and adding elements to it from scratch? Something like HIAboutBox but which works on OS X 10.8 as well.
Cocoa has built-in support for displaying a standard about box, and projects created from any of Xcode's templates will have this wired up to the "About MyApplication" menu item in the application menu. It works by calling -[NSApplication orderFrontStandardAboutPanel:]. It automatically pulls the basic information from your application bundle (icon, name, version, build number, copyright notice). It also supports displaying extra information by looking for a file named Credits.html / Credits.rtf / Credits.rtfd in the application bundle.
Related
My fellow developer and I are working on a macOS app.
I'm running Xcode 8 on 10.12
He's running Xcode 7 on 10.10
Deployment target is set to 10.10
I developed the project on Xcode 8 on 10.12.
I am using an NSStackView for one section of the UI. App runs on my OS (10.12) and his OS (10.10) after I put in some version checks and "if version > x then run (code)" to address the changes made to NSStackView in 10.11.
The majority of the project (all but the xib containing the NSStackView) will open in his 10.10+Xcode 7 after I set "Opens With..." to "Xcode 7.x".
The Xib with the NSStackView, however, will not. He cannot open it. He also cannot compile the project as it complains that:
"The document “ControllerWithStackView.xib” requires OS X 10.11 or later"
I'm assuming that the xib contains additional information on the 10.11-enhanced NSStackView that his older OS and Xcode can't handle.
Does anyone have any ideas on how I might change things such that he could continue using 10.10 and Xcode 7 while I use 10.12 and Xcode 8? For several reasons it's preferred that he keep his current OS.
My ideas:
Don't embed the NSStackView in the xib via interface builder. Instead, create it in the controller via code
Don't use NSStackView. While it does work for our purpose (traditional add/remove/show/hide behavior ideally tailored to the stack), I suppose I could either use an NSTableView or code something custom
Are there other options? Are there any magic settings in Xcode 8 that I could set to say "hey, this stack view should be aiming for 10.10"?
Any insights on how people approach situations like this would be very much appreciated.
Thank you,
Eric
I am working with multiple Mac projects that were written during the awkward time between OS 9 and OS X, so it is written in pure C using Carbon, no Cocoa, Objective-C, or really anything modern in sight. Some of the projects I have the .xcodeproj files for, but they are useless with modern XCode (the project files were created with XCode 1).
I've brought some of them into XCode projects under XCode 6 (the earliest version I have access to right now) using the Command Line Application preset and the 10.4 SDK restored. However, using this present doesn't actually build a proper .app, so the nibs never get included. I tried writing some non-nib Carbon apps (unrelated to the old code), and it seems like everything up to opening windows and drawing into them works, but the windows never updates, even all the Carbon Event handlers are in place. Clicking on buttons does nothing, I can't drag the windows around, and the app never even appears in the dock. It seems the entire app just stops after the call to RunApplicationEventLoop()
I tried putting some of the code into a project made with the Cocoa preset with all of the premade code stripped out, but that seems to have just made XCode angry. Is there any way to essentially get a replacement for the Carbon App present that was in old versions of XCode?
I am writing Contextual Menu Plugins for Leopard OS and referring Writing Contextual Menu Plugins for OS X, part 1 article by Brent Simmons. My plugin is working fine.
Is there any way to move my test menu into main menu (above the Label)?
The short answer is "no".
The OS controls what gets displayed in that menu, so in order to change it around, you would need to call private methods, reimplement system-level functionality, and just in general do some Very Bad Things which would be unsafe, could break at a moment's notice, and possibly work differently between even dot releases of the same OS.
Yes, it's called a system service, and was introduced in OS X 10.5. I know for a fact that many applications can do this, and Automator routines can be triggered this way because Automator itself is a system service. To see a service applicable for an application (i.e. Finder) go to the Application menu on the top bar (for lack of better name T_T), such as the Finder bolded text, and go down to Services > and it will show you all services that can be used in the app. If you need pointers on how to build this, just comment here.
EDIT: Yes, a SIMBL plugin is also considered a service, and on second read of your question, that's what you want.
I need to have multiple windows on main window. same as MDIForms. That means having parent and child relationship between main window and other windows.
But I am not getting how to implement this. can anyone help me for this...
Have you read the Window Programming Guide for Cocoa?
In essence, Apple's opinion of MDI is...
"The MDI tendency directly contradicts
Mac OS X, in which windows are
document-centric rather than
application-centric. No parent
application "main window" exists--the
menubar and other interface elements,
like palettes, are used to constantly
indicate which application is active.
Document windows are only constrained
by the user's desktop size (which
might span single screen or multiple
monitors)."
Taken from Apple's Switch to Mac OS X developer document (see the "Mac OS X Doesn't Use MDI" section). Whilst this is quite an old document, nothing has changed in this respect.
I would like to create a preferences window like in the standard Mac OS X apps (Safari etc.). I have found resources like DBPrefsWindowController from back in 2008 that matches the Apple HIG.
Just wondering if there is a new way to accomplish this? I can't locate any standard windows in Interface Builder so I assume Apple doesn't provide those, nor can I locate a official Apple sample code for providing this standard UI.
Thank you
It seems DBPrefsWindowController is no longer available.
For now, I would recommend the up to date RHPreferences framework.
Available on GitHub. BSD Licensed.
It’s a simple and easy Preferences window controller with multiple tabs for your next Mac application.
It also provides:
Auto resizing between different sized tab views (With animation)
Custom NSToolbarItem support
Persistence of the last used tab
Support for placeholder NSToolbarItems (eg NSToolbarFlexibleSpaceItemIdentifier & NSToolbarShowFontsItemIdentifier)