Creating animated progress bar in iOS

I am trying to make a custom animated bar graph for an iPad application (i.e., bar height increases to set level when activated). I am quite new to iOS development and I just want to get feedback on how to approach this task.

I am trying to play around with the answer in this entry and I want to know if it's right that I'm starting from this point.

-------------Problems Reply------------

If you just want a solid bar, you can create a UIView of the size and placement that you need, set its background color, and add it to your view. This is decent coding, no shame in using a UIView to draw solid rectangles. :]

For more complicated graphics, you might want to create a custom subclass of UIView and override its drawRect message to do some custom drawing. For example:

- (void)drawRect:(CGRect)rect
{
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(context, 4.0);
CGContextSetRGBStrokeColor(context, 1.0, 1.0, 0, 1.0); // opaque yellow
CGContextMoveToPoint(context, x1, y1); // for suitable definition of x1,y1, etc
CGContextAddLineToPoint(context, x2, y2);
CGContextStrokePath(context);
}

or whatever other CGContext* sort of drawing you might want to do (e.g. pie charts, line charts, etc).

To animate a bar that you create by adding a UIView with a background color, stick the following whenever the animation starts:

timer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(onTimer:) userInfo:nil repeats:YES];
self.startTime = [NSDate date];

and then add the following message (note: the bar will grow upwards).

- (void) onTimer:(NSTimer*)firedTimer
{
float time = [self.startTime timeIntervalSinceNow] * -1;
if (time>kMaxTime)
{
[timer invalidate];
timer = nil;
time = kMaxTime;
}
int size = time * kPixelsPerSecond;
myBar.frame = CGRectMake(x, y - size, width, size);
}

idk about that link, but you can generate them from here http://preloaders.net/ that should give you a good base to make your own

Category:ios Views:6 Time:2011-09-29

Related post

  • What is the best way to create a progress bar for data processing? 2011-12-10

    This is is my case: I upload an Excel file and each row is read into a table. Then each row in the table is processed before the user gets feedback. This processing can take some time. How can I create a progress bar that shows how many % of the rows

  • How can I create a progress bar with percentage? 2012-01-31

    I want to create a progress bar with jquery or javascript that finds the percentage while loading the javascript. All the images are loaded in the javascript, they use the jquery append tag and so I want to load all these images with a screen that is

  • How to create a progress bar 2010-10-13

    On a button click, I want to display a progress bar, When it completes 100% want to load something,For this stuff i want to use jQuery as well as css. I need some help, how to implement it. --------------Solutions------------- The jQuery UI library m

  • Animated progress bar in NSMenuItem 2010-11-03

    I want to put an animated progress bar in an NSMenuItem custom view. This is demonstrated in Apple's MenuItemView sample, but it doesn't animate (at least not in 10.5, and the sample is apparently from 10.4). I have tried setting a timer that calls s

  • How can I create a progress bar attached to a server-side process? 2010-11-17

    We just ran into a problem with our cloud host - they've changed their apache settings to force a much shorter page timeout, and now during certain processes (report creation, etc.) that take more than 15 seconds (which the client is fine with; we're

  • Create upload progress bar with php 2010-12-14

    I cannot create upload progress bar.I have no idea about it.Please help me... Thanks Amit --------------Solutions------------- you could consider this article: PHP Progress bar Try these http://www.raditha.com/php/progress.php , http://www.johnboy.co

  • How do you create a progress bar when using the "foreach()" function in R? 2011-03-24

    there are some informative posts on how to create a counter for loops in an R program. However, how do you create a similar function when using the parallelized version with "foreach()"? --------------Solutions------------- The following code will pr

  • How do I create a progress bar for data loading in R? 2011-05-28

    Is it possible to create a progress bar for data loaded into R using load()? For a data analysis project large matrices are being loaded in R from .RData files, which take several minutes to load. I would like to have a progress bar to monitor how mu

  • Creating multiple progress bar programmatically inside a grid 2011-11-23

    I would like to create multiple progress bars inside a grid or table through code (VB.Net). The layout of the structure is as follow: Game 1 [ Progress Bar 1 ] Downloading 2MB of 4MB Game 2 [ Progress Bar 2 ] Downloading 4MB of 5MB Game 3 [ Progress

  • How to create a progress bar in excel online? 2013-05-30

    Hello everyone! I'm quite new to Office Online and I'm loving it so far! In Excel Online, I want to create a progress bar, which I saw on the template: 'Assignment Schedule'. I would like to know how to make a sort of percentage bar to show progress

  • How do I create a progress "bar" similar to Grooveshark? 2010-12-12

    I'm curious... how would I go about creating a custom progress bar like the one Grooveshark used to have? If you look at the image below, the progress bar is an image in the shape of a shark and fills in as the page loads. I think this is very cool a

  • Updating the progress bar in iOS 5 2012-03-13

    I am developing an iOS audio player, and I want to implement a progress bar that will indicate the progress of the current song which is playing. In my ViewController class, I have 2 double instances - time and duration, and a AVAudioPlayer instance

  • create upload progress bar using zend and jquery 2010-09-23

    i have to create upload center site like speedyshare.com with zend but i don't have any idea how to create progress bar to show upload progress . any idea or a tutorial to doing this ? --------------Solutions------------- I used this: http://www.uplo

  • In Desktop application how to create popup progress bar 2010-12-19

    I work on C# .I want to create a Desktop(not web) application in c#.There i need to popup window like as web.When popup window appear user can not access any control like web loading panel property MODEL=true.My application work flow is: Popup appear

  • Creating a progress bar in a CLI application 2011-06-20

    When using tools like bzr, doxygen and scp or wget, I see that all of them have a nice progress bar that looks like this: |=============>---------| 55% ETA 3:30 I tried writing something like that in C++ using the \b character as many times as I h

  • animated progress bar by script for IE8 2012-03-21

    Please, help me. I need an advice in problem with progress bar in IE. It should be animated, as showed in http://www.webappers.com/progressBar/. I downloaded jquery.backgroundpos.js, but still it works weird for IE. In chrome it animates with horizon

  • How do you create a progress bar class that loads different types of files from both the /res and /assets folder in Android? 2012-04-03

    Here's the core of my ProgressBar class: package nttu.edu.activities; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Stack; import nttu.edu.R; import nttu.edu.graphics.Art; import androi

  • how to show create PHP progress bar showing progress of file upload and data insertion into database 2011-02-05

    Possible Duplicate: Upload Progress Bar in PHP guys, i need some help with this problem I'm doing a file upload process where the source file is transfered to the server and then the data from it is inserted in to database. i need to display progress

  • java code fore creating 2 progress bars, which showing the % of db migration and % of record migration 2011-06-20

    I have a Java application, which is used to migrate data from Java db to MySQL. And the migration % will be displayed in a progress bar. The progress bar value depends on migration process. Please help me.

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.252 (s). 11 q(s)