7
Ho questo codice nel mio metodo drawRectdrawRect non è rinfrescante lo schermo
float aValue = .0167f;
float fValue = 20;
for(int i=1; i<=6; i++)
{
CGContextSelectFont(context, "Arial", fValue, kCGEncodingMacRoman);
CGContextSetCharacterSpacing(context, 0);
CGContextSetTextDrawingMode(context, kCGTextFill);
NSString *hString = [[NSString alloc] initWithFormat:@"%i",i];
CGContextSetRGBFillColor(context, 1, 1, 1, aValue);
CGContextShowTextAtPoint(context, i*25, i*16, [hString UTF8String], [hString length]);
aValue += 0.167;
fValue += 1;
}
sto chiamando un metodo che utilizza NSTimer come questo
staticTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(refreshUIView) userInfo:nil repeats:YES];
Ecco l'refreshUIView
-(void)refreshUIView
{
[self setNeedsDisplay];
}
Il problema è che drawRect non sta pulendo lo schermo, è solo finita la scrittura di quello che è stato scritto l'ultima volta sul ghiaione n.
ha appena rilevato che l'impostazione Opaco: NO a tale UIView aggiornerà automaticamente drawRect. – coure2011