August 2011
Intermediate to advanced
552 pages
23h 48m
English
Figure 22.6 shows a program that counts the number of words in a text field as well as the number of unique words. Text fields are updated with the values.
Figure 22.6 WordCounter screenshot

The code for this application is straightforward. In Xcode, make a new Cocoa Application (not document-based) called WordCounter. Add the objects seen in Figure 22.6: an NSTextView, a count button, a progress indicator, and two labels for the different counts. Configure your object layout appropriately. Update your AppDelegate class to point to the UI items, as well as the -count: action method:
#import <Cocoa/Cocoa.h> @interface ...
Read now
Unlock full access