I have created a subclass of UIView that is designed to display a rectangle of a certain size (a view Within) based on the value of a variable.
// interface #import & lt; Foundation / Foundation. H & gt; #import & lt; Quartzcore / Quartzcore H & gt; @interface: UIView {NSString * name; Some variables; } @ Property int some variables; @protect (assign) NSString * name; - (zero) BuildStatus: (NSString *) withName; - (zero) drawing: (CGRTact) Rect; @end // implementation #import "Status.h" @ implementation status @ synthesis name, some variables; - (zero) CreateStartus: (NSString *) withName {name = withName; Some variables = 10000; } - (zero) direct: (CGRact) shortcut {CGContextRef context = UIGraphicsGetCurrentContext (); // Draw Status CGContextSetRGBFillColor (Reference, 0.0, 0.0, 1.0, 1); // Fill CGContextFillRect (Reference, CGRectMake (0.0, 0.0, someVariable, 40.0)); } //// myviewcontroller implementation - (zero) viewDidDuper: (BOOL) animated {[Superdudepiper: animated]; MyStatus = [[Status Alok] InitVithframe: CGRactack (8, 8, 200, 566)]; MyStatus.backgroundColor = [UIColor Gray Color]; [Self.view addSubview: myStatus]; }
How do I set it up so that I can refresh a status bar again and again? I'll probably refresh 4 times per second using a NSTimer, I'm not sure what to call me or if I should take this rectangular drawing to a different function or some other place ...
Thanks in advance for your help :)
just use
[self. Set Set Display]; Your view controller
You probably want to do this on the main thread, so it may be possible with the display, selectorOnMine Object with: Waitinute Done:
In the setNeedsDisplayInRect:
you must also specify that, but also your code is light and fast, and you probably have to calculate the reset to calculate for the updated area. So I will update the entire UIView if it does not appear to slow your application significantly.
As a side note, you probably want to make your name property (transcript), using the change (and self.name = ...
below your feet) In that case, do not forget to release it in the DLOK.
Comments
Post a Comment