hi, i have done following to translate background screen.view.m file.but the frame rate is very slow.i changed time interval with different value,but the image is translating very slowly in Iphone Device? any solution?pls?
- (id)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
// Initialization code
x =0;
xx = 0;
yy = 0;
secX = 0;
[NSTimer scheduledTimerWithTimeInterval:(0.1/60) target:self selector:@selector(onTimer) userInfo:nil repeats:YES];
}
return self;
}
-(void) onTimer
{
xx++;
xx = ( xx % 320);
[self setNeedsDisplay];
}
- (void)drawRect:(CGRect)rect {
// Drawing code
[[UIImage imageNamed:@"graphic.png"] drawAtPoint:CGPointMake(yy,xx )];
if(xx >= 0)
{
[[UIImage imageNamed:@"graphic.png"] drawAtPoint:CGPointMake((-320 - (-1 * xx)),yy)];
}