7
je ce code dans ma méthode de drawRectdrawRect n'est pas rafraîchissant l'écran
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;
}
J'appelle une méthode utilisant NSTimer comme celui-ci
staticTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(refreshUIView) userInfo:nil repeats:YES];
ici est le refreshUIView
-(void)refreshUIView
{
[self setNeedsDisplay];
}
Le problème est que drawRect n'efface pas l'écran, il est juste écrit ce qui a été écrit la dernière fois sur les éboulis n.
Je viens de trouver que le réglage Opaque: NON à cet UIView actualisera drawRect automatiquement. – coure2011