jammyxvtrOD posted an update 10 months, 3 weeks ago
i < count; i++) dataPointAtIndex: i x: &x y: &y]; if (x != x0 y != y0) return NO; return YES; – (IBAction) compute: (id) sender #pragma unused(sender) if (pointsAllTheSame]) NSAlert * alert = NSAlert alloc] init]; setMessageText: @ï¿½No distinct pointsï¿½]; setInformativeText: @ï¿½There must be at least
two ï¿½ @ï¿½distinct data points for a ï¿½ @ï¿½regression to be possible.ï¿½]; addButtonWithTitle: @ï¿½OKï¿½]; beginSheetModalForWindow: windowForSheet] modalDelegate: nil didEndSelector: NULL contextInfo: NULL]; autorelease]; else refreshData]; setSlope: slope]]; setIntercept: intercept]]; .
setCorrelation: correlation]]; Now run Linear and enter a data set consisting of two or more points, all identical. Because there are at least two points, the Compute button activates, but pressing it brings up the alert sheet, as shown in Figure 19.1. 304 CHAPTER 19 Finishing Touches FIGURE 19.1 The no-distinct-points alert as it appears in Linear. The string set in the NSAlert instance method setMessageText: appears in boldface on the top line of the alert, and the rest of the text is supplied by the string passed to .
setInformativeText:. Localization Weï¿½re pretty satisfied with Linear, but having it available in French would really make it perfect. Users of Mac OS For Search Engine Optimization Service contact NetTrackers
X specify what languages they understand by setting a list of available languages in order of preference in the Language tab of the International panel of the System Preferences application. When a userï¿½s list sets French at a higher priority than English, weï¿½d like Linear to present menus, alerts, and labels in the French language. When they search for application resources, the NSBundle and CFBundle facilities first search .
the subdirectories of the application bundleï¿½s Resources directory, in the order of the userï¿½s preferences for language. Language subdirectories are given such names as English.lproj, fr.lproj, or en_GB.lproj; plain-text
names are now deprecated, and itï¿½s preferred that you use ISO-standard language abbreviations, optionally suffixed with a code to identify a regional variant. If we look in the Finder, we see that an English.lproj directory is associated with Linear and contains Credits.rtf, InfoPlist.strings, MainMenu.nib, and MyDocument.nib, as well as Interface Builderï¿½s backup copies of NIBs. Reviewing those files in Xcodeï¿½s Groups & Files list, under the Resources group, we see that every file that appears in the English.lproj directory has .
a disclosure triangle next to it. Opening the disclosure triangle reveals the localized versionsï¿½in every case so far, English. Credits.rtf We havenï¿½t looked at Credits.rtf before. If a file by that name is available in Resources or a localized subdirectory, its contents will be displayed in a scrollable view in the appli- cationï¿½s About box. The file is filled with silly credits that are obviously intended to be replaced. We will not replace them but
instead make them French. Control-click .