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 6978583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:46:32+00:00 2026-05-27T17:46:32+00:00

I have a model which can download data from a server and thus an

  • 0

I have a model which can download data from a server and thus an activity indicator needs to be displayed (both in the status bar and on screen).

But I also have a UIWebView which is displaying content, the content has links, some are local and some are remote, if a remote link needs to be downloaded then an activity indicator needs to be displayed again.

What are design options for accomplishing this?

The app delegate could have methods to start and stop the activity indicators as directed by the models and controllers. But somehow this doesn’t seem quite clean to me – its starting to use the app delegate just as a bucket for dumping miscellaneous functionality.

I’m thinking the model should deal with its own activity indication and the controllers should deal with their own, i.e. separate them. However if I did that wouldn’t we then have the situation where a model is doing some UI related stuff (even if minimal)?

Is there a clean recommended solution?

  • 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-27T17:46:33+00:00Added an answer on May 27, 2026 at 5:46 pm

    IMO, Activity indicator is a View component independent of a specific view therefore it should be managed by your application delegate.

    The way I tackled it is I created an ActivityManager class and I create and instance in my application delegate. It takes an instance of UIWindow and from that, I can determine how to center and display the indicator appropriately. All other areas of my application interact with this class through the observer pattern. They post notifications when the network state has changed and my activity manager evaluates the overall state of the application to see if it needs to either show or hide the indicator. Here is a sample of what you might see in my app:

    ActivityManager *activityManager = [[ActivityManager alloc] initWithWindow:self.window];
    
    self.activityManager = activityManager;
    
    [activityManager release];
    
    [self.activityManager addNotification:kNetworkStatusDidChangeNotification];
    
    [self.activityManager addAsyncActivity:[HttpManager defaultManager]];
    
    [self.activityManager startObserving];
    

    I’ve added the ability to add new notifications so that way, when the manager observes these notification is can evaluate what needs to happen. AsyncActivity is just a protocol for singletons I can check to see if they are processing data. Then I just tell my manager to start observing. When I close my app I simply call:

    [self.activityManager stopObserving];
    

    to remove all observers and free up any memory. That should get you started in the right direction, I’m sure there are other ways to do it but that seems like the least invasive way to handle it to me. It’s also very portable.

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

Sidebar

Related Questions

I have a model which gets its data from a parser object. I'm thinking
I have a model Book which can be added to user's Favorites. So I
I have a class which models all categories and they can be ordered hierarchically.
I have model Foo which has field bar. The bar field should be unique,
I'm using ASP.NET MVC and have a model which has an image (byte array)
I have a model Foo which have a ForeignKey to the User model. Later,
I have a model Task which will HABTM many TaskTargets. When it comes to
I have an Entry model which has many Tag s. Tag s are added
I have an edmx model which I have draged 2 tables onto - One
Here's what I'm trying to do, and failing... I have a File model which

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.