Using UIProgressView as a Progress indicator for goals

I've tried figuring this out on my own, and am completely clueless as to how to accomplish it. Essentially what I'm trying to do is this: The Overall Goal: Use the UIProgressView as a "different type" of indicator than what it's meant for. Details: When a user 'completes' a 'goal' (by pressing a UIButton named "complete" in a separate UIViewController, let's call this one "View Controller 1") I'd like it to update a UIProgressView in a second UIViewController (call this one "View Controller 2"). There are several UIProgressViews in View Controller 2, each representing the # of goals in a category 'completed'. So I'd like to have a void method in View Controller 2 like this:

 (void)progressMade:(NSString *)category
{
   categoryOneProgressView.progress += 1/8 ;
   //this would be called from View Controller 1, after the "complete" button was pressed.
}

Thank you in advance for your help.

Answers


What you can do is on Touching of Button in VIEW CONTROLLER 1 you store the Value of the goals completed in a particular category. Example Code for View Controller 1:

-(void)methodTriggeredOnCompleted:(NSString *)category
{
    //Do you calculation for progress of a category 

    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

    [defaults setValue:saveProgressValue forKey:category];
    [defaults synchronize];
}

Now in View Controller 2 what you should do is in ViewDidLoad method or in ViewWillAppear method you should get the value you stored in NSUserDefaults and update it in progress bar value

-(void)viewDidLoad
{
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    int val = [defaults valueForKey:category];
    categoryOneProgressBar.progress = val;
}

Need Your Help

is this CoreText? - Aviary text pinch zoom expand

iphone ios uitextfield core-text

I am looking into making an app where a user can change the size and orientation of UITextField. I was looking into Aviary app and what I see is that users can not only increase or decrease the siz...

In Silverlight, add custom property to a generated Linq class + manage events

silverlight linq datacontract deserialization

I'm using Linq to SQL classes in my WCF. Those classes are returned from the WCF methods to the Silverlight. Now, I want to add a custom property on a the generated class (Silverlight side) and tri...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.