Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7556719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:56:03+00:00 2026-05-30T11:56:03+00:00

My end goal is to draw a report that looks like MS Word using

  • 0

My end goal is to draw a report that looks like MS Word using Quartz into a UIView, having and then having that UIView in a UIScrollView.

What I have now is a top level Report Object, and then it’s children are parts of the report to draw like ReportTitle, ReportTable, ReportSplitColumn, etc. The top level Report Object looks like:

@property (nonatomic, retain) UIFont *font;
@property (nonatomic, assign) CGFloat margins; 
@property (nonatomic, assign) TextObjectStyle style;
@property (nonatomic, assign) CGColorRef color;

- (CGSize)size;

In my proof of concept, I created a ReportView object that knows how to draw ReportObjects that take a specific ReportObject, and draws it at a specific point. So my drawRect would like something like:

//pseudocode
drawRect: {
  //get the current context
  CGFloat startHeight = 0;
  CGPoint point = CGPointMake(0, startHeight);
  startHeight += [self drawReportTitle:currentContext atPoint:CGPointMake(0, point.y)].height;
  point.y = startHeight;

  startHeight += [self drawParagraph:currentContext withText:paragraphs atPoint:CGPointMake(0, point.y)].height;
  point.y = startHeight;

}

What I started trying to do was have my ReportView have a property of NSArray *ReportObjectsArray and then have my caller class set that value, and then have my ReportView draw it. I was hoping I could do something like:

for (ReportView *r in self.ReportObjectsArray) {
  startHeight += [self drawReportObject].height atPoint:CGPointMake(0, point.y;
  point.y = startHeight
}

Except the problem I realize is, my own classes don’t know how to draw themselves. I think I remember seeing this pattern in a Java book where the class knows how to draw itself. And that does make sense to me. However the problem I ran into was in the end, I want one UIView of type ReportView that is scrollable in UIScrollView. I wasn’t really sure if each ReportObject should subclass UIView instead and then add each of these objects to the UIView in the scrollView as a subView, and then have it draw itself that way. Is that the better way to go? I’m not really sure. If it’s not, what is my alternative? Would I have all my classes have a draw method, but in it, it just posts a notification and then in my ReportView class, I can have it listen to those notifications, and then call the appropriate draw methods? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T11:56:05+00:00Added an answer on May 30, 2026 at 11:56 am

    You definitely want to use a hierarchy of UIViews rather than implementing a lot drawRects. UIKit is very good about optimization and you defeat that if you do a lot of non-optimzed/naive drawRects.

    You might or might not create custom UIView subsclasses for all your objects. It may be enough to use the builtin UIView subclasses and just create them based on your report objects. Subclassing is more complicated but is generally needed if you need to do more custom layout (in layoutSubviews) than the standard struts and springs provide.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First off, let me define the end goal: I'd like to Wordpress (version 2.8)
The end goal is to have some form of a data structure that stores
My end goal is to get Erlang syntax highlighting in QsciScintilla using PyQt4 and
Note: I've only been using Objective-C for a week. Here's my end goal: I
My end goal is to accomplish something like: CREATE FOREIGN KEY IF NOT EXISTS
My end goal is simple. I am building a website that has three components:
My end goal is to create a firefox extension that inserts an HTML button
The end goal is to connect two query parameters that are being passed to
having some issues with a networking assignment. End goal is to have a C
My end goal is to create a checkbox that, when selected, checks all the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.