Exercises
Save a MathPaper file containing several calculations and then view the contents of the file in a Terminal window with the
catcommand (or by using an editor). Look up and identify any RTF commands that we didn’t discuss in Chapter 12.Reimplement the methods dataRepresentationOfType: and loadDataRepresentation:ofType: so that the NSData object contains a serialized NSDictionary object that itself contains the window’s
historyandframe. The advantage of using an NSDictionary object for archiving is that it can give you both forward and backward compatibility with your saved documents — provided that later versions create the fields that the older versions expect to find.Reimplement the methods dataRepresentationOfType: and loadDataRepresentation:ofType: so that the NSData object contains an XML representation of the window’s
historyandframe. What are the advantages of using XML?Add a calculator-like keypad to MathPaper so that users can click buttons to create mathematical expressions in MathPaper’s key window. Implement this so that only one of these calculator-like keypads is needed for all of MathPaper — the new window should be a floating panel (utility window) that automatically inserts characters into the key window.
For each MathPaper document window, add an auxiliary window that displays the contents of the
historyinstance variable as it’s being filled with mathematical expressions and results. You will need to upgrade the MathDocument class and create a separate ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access