Creating an if statement for a checkbox in an OSX app - objective-c

I'm trying to add a working checkbox to the welcome window of my OSX app.
I have already added the checkbox to the app in Interface builder.
I would really appreciate if someone could help me with writing the IF STATEMENT for a CHECKBOX in an OSX project.
I need the checkbox, which is on a welcome screen type window, to be selected when the app is opened (already done). When the checkbox is deselected by the user, when the app is run again, the welcome screen should not appear.
I have already sorted out writing to and getting the preferences, I just need to write the proper if statement and I can't quite get it right.
I do not want links to UIButton stuff (that is IOS!) and I do not want links to iPhone tutorials, etc.
I need help with OSX coding! Please! Would be very much appreciated.

Use Cocoa bindings.
Bind the value binding of the checkbox to some key on the Shared User Defaults Controller. The logical place to store simple preferences would be NSUserDefaults.

Related

What type of rollover menus does Apple use in their Contacts App?

Does anyone know how Apple creates their rollover menus in the Contacts "business card" view*? I am trying to replicate that interface in an App I'm writing, but I'm not sure how to get there via XCode. I'm currently running Mavericks...
Thank you in advance!
* i.e. the "work" heading for an address is a context-sensitive popup menu that allows you to copy the address, open in maps, etc...
I wasn't able to replicate the Contacts interface exactly (I suspect they are doing some custom drawing routines), but I came up with something that was good enough for me. I created pulldown buttons with the "gradient" style, and visual set to "bordered".
Here is the key: during startup, I call the following:
[myButton setShowsBorderOnlyWhileMouseInside:true];
When you hover over the button, it highlights. Click, and the menu drops down. Perfect!

Programmatically create grid view

I am working on an app in which i am trying to implement something like this :-
1: First of all,i created a button(whose name here is "Create a new folder"). On clicking that button,an alertview will appear which will ask for the name of the button which is going to be created on click.
2: The above process will be repeated each and everytime when we click on "create a new folder" button.
3:The buttons which are created at runtime will be arranged in a grid view format.
Above shown screenshot will let you know about the required arrangement.
I've tried this by using UITableview and making columns in it. But i am not able to create folders at runtime.Please help me find any way to solve this. Suggestions will be highly appreciated. Thanks in advance.
Try UICollectionView if you can require iOS 6. There is a simple Guide on Apple's site too.

How to create a selection page in Cocoa Obj-C for Mac

I am creating an application for Mac using Xcode 4.2, and I wanted to create a page on startup somewhat like the ones in GarageBand and Microsoft Office. The user would be able to select an option (template) and then press 'Choose' to start working with that template. The following images depict the startup (option) screens of GarageBand and MSOffice:
Please note that both of these have an interesting way of selecting an option (template) to begin.
I would like to know what kind of UI Element or special class is being used for this. I do realize that a lot of custom artwork would go into this. Please also explain how these items are used like a radio button, not a normal button.
Those are almost certainly done with an NSCollectionView. NSCollectionView can be a little difficult to work with (in my limited experience) so I would start by looking at the docs:
Quick Start for Collection Views
NSCollectionView Class Reference
And then at some tutorials:
NSCollectionView Tutorial for Dummies (Xcode 3.1.3) (A little out of date but still helpful)
Adventures with NSCollectionView

Mac OS X: Global Shortcut to get selected text/image in Application

I'm trying to build an app that get's selected text from other applications if a certain shortcut/hotkey is pressed. First I tried the Carbon Hotkey API, but then I couldn't get selected text from other applications. Second I've tried building a service that gets the selected text from other applications and is called with a global shortcut, but I wasn't able to use a custom shortcut. Somehow only CMD+SHIFT is allowed as a modifier in the plist and these kind of shortcut is already used in many applications so it's often not working. CTRL and a key would be a cool shortcut, because not many applications use this kind of shortcut, but I can't specify such a modifier.
Any Ideas how to solve this problem?
To answer your second question, you can manually edit the Services plist file. Find details here:
Set Custom KeyEquivalent in Services Menu

Multiple windows or "pages" in an application

I am a newbie in Mac application development. I want to write a GUI application in Cocoa using Interface Builder. I want multiple screens i.e. when one button on a screen is clicked, another screen should be displayed. How can I activate a new screen at button click event?
I would heartily recommend Aaron Hilegass's book Cocoa Programming for Mac OS X. It took me from feeling like everything was impossible to being relatively competent in the space of a few short weeks. I was very impressed with it.
Apple's documentation is amazingly good, but it takes a while to get used to the style, and you will need to know which objects actually exist before you can look up how to use them, which is where Aaron's book comes in.
Your library may have a copy of it, or be able to order one for you if they don't.
I think you mean windows, not screens. Screens are the displays (monitors) on which all the user's windows from all the user's applications appear.
And I second Jonathan's recommendation of the Hillegass book.
The button has a target. That should link to the new window. As its action you can tell the window to show itself.
Take a look at:
http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/WinPanel/WinPanel.html
I think what you want is the type of interface like that seen in Coda, or System Preferences where there is a toolbar on the top of the screen that can be used to select between the content of the window.
The simplest method I have found is to use BWToolkit.
Another method is to use a series of views, and switch between them when the toolbar is clicked. I've found one description here, but that's not the one I used first (which may have been originally in Ruby Cocoa, IIRC).
NSTabView.