Hello, I've scoured the 'net (including this list's archives) and found many useful bits of info that have gotten me this far, but I fear I am stuck. Apologies if I've simply missed something in my searches.
I have my CoreData Document-based app and 'print' ends up allocing and initing up a PrintViewController, passing it the MOC. This in turn loads up PrintView.xib. 1) is this the/a preferred way to handle this? I based it on the myWindowController:initWithMOC pattern that I've seen done and am doing for windows. Now the view should print a bunch of data (ideally with a header covering ~20% of the first page). I get my calls to -knowsPageRange:aRange and -rectForRange:pageNumber just fine. Retuning (1,2) and then [self view] for both pages prints my view (currently just a 'hello world' text view) twice over. Nice. My next step was to get different things on each page. Ignoring the banner for now, I added a switch to rectForPage that would modify the value of the string depending on page number, and then return [self frame] each time. 2) Is modifying the contents of the view for each page allowed? I couldn't get it working but it feels like the kind of thing that maybe shouldn't be expected to just work and so I moved on. Also feels slightly hacky. Please let me know if this is a viable approach I should keep working on. Next I added new views to the NIB 'coverpage view' 'page view' and placed a coverPage on the printview as there is always one of those. The idea is that knowsPageRange will see if the data can fit on the 80% remaining of the cover page, and if so, we just print a single page with the frame. So far so good, but now my problem lies with the arbitrary number of 'page views' that may come after the cover. I was planning on instantiating 'n' of these, and adding to the main view one by one in knowsPageRange, and then just return it rect by rect for each page. 3) If I layout the page in IB, how do I create multiple instances of it to drop onto the main print view? May I simply call addSubview on the parent with it multiple times? Does this end up with different instances of the page that I can then modify to show different segments of data or is this literally showing the exact same view several times over? Is there some other way to create multiple instances of one view from the NIB? 4) I don't (yet) think I need to subclass the views for the coverpage and page views, correct? Because I can just lay them out in IB. Perhaps I may have to when it comes time to actually start displaying data? 5) Lastly, all this building the print view requires manipulations on 'stuff' on the view, which are connected to outlets in the PrintViewController as it is File's Owner. What is the standard way of accessing these? I figure it could pass them one by one to the view, but that seems fragile going forward and overly verbose. Alternatively it could pass 'self' to the printview (either as delegate or a new property) through which it can be used to get at the various outlets. I'm thinking the delegate way, is this the standard convention? Sorry for the massive essay/email, but I appreciate any input whatsoever! Cheers, - David Mirabito _______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
