views:

146

answers:

0

Hi,

i just noticed, having a backgroudn image inside of a UIScrollView along with some other UI-Elements, that they scroll with different speed.

i created a UIScrollView child in my main view, added this testing code:

-(void)viewDidLoad {
[super viewDidLoad];

oRulerYear.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed:@"bg.png"]];
//bigsize!
[oRulerYear setContentSize:CGSizeMake(2400,100)]; 

CGFloat x = 0;
CGFloat y = 0;

CGRect rect = CGRectMake(x , y, 120.0f, 45.0f);

//label 1
UILabel *label = [[[UILabel alloc] initWithFrame:rect] autorelease];
[label setText:@"Foo"];
[oRulerYear addSubview:label];


//label 2
x = 2000;
y = 10;
rect = CGRectMake(x , y, 120.0f, 45.0f);
UILabel *label2 = [[[UILabel alloc] initWithFrame:rect] autorelease];
[label2 setText:@"Bar"];
[oRulerYear addSubview:label2];

}

Scrolling DOES work, but i see a differen speed of scrolling on both label tags. so its quite like an 1980 pc game, or reverted parallax-scrolling or however its called. background seem to scroll faster than foreground.

Any ideas how to prevent that behaviour?