Exercises

  1. The font size of the input text is small for an application such as MathPaper. What changes need to be made in MathPaper to increase the font size of all mathematical expressions that are entered by the user?

  2. Calculate sin(pi) using this chapter’s version of MathPaper. Does anything unusual happen? If so, why, and what can be done about it?

  3. Extend the RTF class in this chapter so that it implements a larger subset of the Rich Text Format specification. To find the RTF specification, search http://msdn.microsoft.com. Use your extended class to support additional fonts and other formatting features in MathPaper windows.

  4. Investigate the use of the Format and Font menus in Interface Builder to support additional formatting in MathPaper. Can they be used? If so, how? Implement your ideas.

  5. Reimplement the RTF class so that it uses an NSMutableAttributedString rather than an NSMutableData object. Instead of building your own RTF, rely on the machinery inside the NSMutableAttributedString class.

  6. Investigate the possibility of rewriting MathPaper so that it still supports RTF but doesn’t require a helper class at all. If possible, do it! First you must carefully read Cocoa’s documentation on NSText, NSTextView, and related AppKit classes. Why do you think we decided to implement MathPaper with a helper class?

Get Building Cocoa Applications: A Step by Step Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.