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

  • Home
  • SEARCH
  • 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 6122563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:54:50+00:00 2026-05-23T15:54:50+00:00

I’ve written my first app that uses web data for building a custom view.

  • 0

I’ve written my first app that uses web data for building a custom view. While it is working, I can’t help but think that maybe it isn’t quite following the MVC concept (thought I’m not sure this plays into how Apple approves apps or not).

I have a single view controller with a custom view class that implements drawRect. Because the drawRect requires data from the web, it felt natural to do all the downloading within the custom view class itself.

But how is this usually done? I am guessing that the view controller should usually handle the downloading, and that the controller is the delegate for the async download so it can arrange views and such based on errors, etc. Instead, my custom view class is the delegate for handling the async, and that just seems poorly organized to me; but maybe it isn’t?

If I were to instead use the View Controller for all the downloading, I suppose I would just set instance variables of the custom view to the results of the download, since the custom view needs the data to draw. Would that be a better approach?

  • 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-23T15:54:51+00:00Added an answer on May 23, 2026 at 3:54 pm

    Apple doesn’t look at your source code as part of the App Store review process, so how you design your classes is up to you. However, you’re right in thinking that in an MVC architecture, views don’t fetch their own data, and in fact never have any knowledge of where the data they’re presenting comes from. The controller layer acts as the bridge between views and model objects, so thats where the responsibility for fetching the data properly lies.

    So I think you’re on the right track: use an instance of a subclass of UIViewController to do obtain the data. From there, it’s up to you to decide whether it makes more sense to ‘push’ or ‘pull’ the data into the UIView subclass you’re designing.

    In the push model, the controller sets instance variables of the view as necessary to present data. In the pull model, the view would typically send messages to the controller to request data prior to drawing. The typical pattern for this in iOS is to have the controller adopt a delegate protocol declared in the header for your custom view class. The view would then try to obtain data when needed by first checking to see whether its delegate implements the necessary methods, and then calling the methods if available.

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

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
I've got a string that has curly quotes in it. I'd like to replace
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into
Does anyone know how can I replace this 2 symbol below from the string

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.