Archive for the 'Interface Builder' Category

Simple starter Cocoa app ideas

Wednesday, December 11th, 2013

Inspired partly by tonight’s Hour of Code, here are some index-card-sized outlines of some simple app projects you can make as someone new to Cocoa.

Text editor/word processor

  • Document-based Mac app
  • In document window: NSTextView
  • Use NSAttributedString to read/write document data
  • Document types:
    • public.plain-text
    • public.rtf
    • com.apple.rtfd
    • com.microsoft.word.doc
  • Extra credit:
    • Add a ruler (NSRulerView)

Picture viewer

  • Document-based Mac app
  • In document window: IKImageView
  • Use CGImageSource to read image (picture) & its properties
  • Document types:
    • public.png
    • public.jpeg
  • Extra credit:
    • Floating inspector panel showing the properties in an NSTableView
    • Color-correction panel (IKImageEditPanel)
    • Support folders (public.folder): display images from folder in IKImageBrowserView

PDF viewer

  • Document-based Mac app
  • In document window: PDFView
  • Use PDFDocument to read from .pdf file
  • Document types:
    • com.adobe.pdf
  • Extra credit:
    • Toolbar with zoom in/out buttons, zoom % field, page number field

Apple documentation search that works

Sunday, March 6th, 2011

You’ve probably tried searching Apple’s developer documentation like this:

The filter field on the ADC documentation library navigation page.

Edit: That’s the filter field, which is not what this post is about. The filter sucks. This isn’t just an easy way to use the filter field; it’s an entirely different solution. Read on.

You’ve probably been searching it like this:

Google.

(And yes, I know about site:developer.apple.com. That often isn’t much better than without it. Again, read on.)

There is a better way.

Better than that: A best way.

Setup

First, you must use Google Chrome or OmniWeb.

Go to your list of custom searches. In Chrome, open the Preferences and click on Manage:

Screenshot with arrow pointing to the Manage button.

In OmniWeb, open the Preferences and click on Shortcuts:

Screenshot of OmniWeb's Shortcuts pane.

Then add one or both of these searches:

For the Mac

Chrome OmniWeb
Name ADC Mac OS X Library
Keyword adcmac adcmac@
URL http://developer.apple.com/library/mac/search/?q=%s http://developer.apple.com/library/mac/search/?q=%@

For iOS

Chrome OmniWeb
Name ADC iOS Library
Keyword adcios adcios@
URL http://developer.apple.com/library/ios/search/?q=%s http://developer.apple.com/library/ios/search/?q=%@

Result

Notice how the results page gives you both guides and references at once, even giving specific-chapter links when relevant. You even get relevant technotes and Q&As. No wild goose chases, no PDF mines, no third-party old backup copies, no having to scroll past six hits of mailing-list threads and Stack Overflow questions. You get the docs, the right docs, and nothing but the docs.

For this specific purpose, you now have something better than Google.

WWDC 2007 session videos are out

Monday, July 30th, 2007

If you attended WWDC, you can head over to ADC on iTunes and see what you missed.

It’s possible to connect an outlet to the content view of a window

Monday, July 24th, 2006

Simply set the Instances tab to outline view. Then you can connect the outlet to the window’s content view.

A nib window, set to outline view, with a content view selected.

Technorati tags: .

A quick IB tip

Friday, June 23rd, 2006

I just discovered this — you can use the numeric keypad to move views in a nib. The benefit of this is that you can perform atomic diagonal moves (as opposed to a rapid sequence of, for example, up followed by left).

UPDATE 2008-11-29: This doesn’t work anymore in Interface Builder 3. Sad.

Report-an-Apple-bug Friday! 40

Friday, May 12th, 2006

This bug is IB refuses to keep pop-up menus open. It was filed on 2006-05-12 at 02:33 PDT.


Summary:

IB closes a pop-up menu being edited in response to any key or mouse event in the menu.

Steps to Reproduce:

  1. Drag a pop-up button into a window in a nib.
  2. Double-click on the pop-up button to edit it.
  3. Change the selection by clicking on any item, or pressing up or down. Or, double-click on an item to rename it, then press return or enter or change the selection.

Expected Results:

The current selected item changes, or is renamed, or both.

Actual Results:

The current selected item changes, or is renamed, or both, and then IB closes the menu, interrupting any plans to further edit the menu until the menu is reopened by the user.

Regression:

This used to work, although I don’t know in what version.

Notes:

No Console output is emitted by IB.


UPDATE 2006-05-24: I got an email from Apple recently telling me that the bug was a duplicate, and just today, Xcode 2.3 came out, including IB 2.5.4 which fixes this bug.


Technorati tags: ,

Report-an-Apple-bug Friday! 33

Friday, April 21st, 2006

This bug is Interface Builder should use +/- buttons for Outlets and Actions lists. It was filed on 2006-04-21 at 21:06 PDT.


Summary:

IB uses “Add” and “Remove” buttons on the Outlets and Actions lists; it should use +/- instead, like the Accounts prefpane.

Steps to Reproduce:

  1. Inspect a class in the nib.
  2. Switch to the Attributes Inspector.

Expected Results:

IB shows small square buttons labeled + and – like the Accounts prefpane has.

Actual Results:

IB shows plain “Add” and “Remove” push buttons.

Regression:

None.

Notes:

None.


Technorati tags: , .

Report-an-Apple-bug Friday! 30

Friday, April 14th, 2006

This bug is ⌘W and ⌘⌥W close Inspectors too. It was filed on 2006-04-14 at 23:45 PDT.


Summary:

When the user presses ⌘W, IB will close a floating window if it has focus. When the user presses ⌘⌥W to close all nib windows, IB also closes all of the floating windows.

Steps to Reproduce:

  1. Press ⌘W or ⌘⌥W.

Expected Results:

The frontmost non-floating window closes, or all non-floating windows and no floating windows close.

Actual Results:

The frontmost window (floating or not) closes, or all windows (including floating windows) close.

Regression:

None known.

Notes:

Floating windows in IB are the Palette, the Alignment palette, and the Inspector.


Technorati tags: , .