I think i’m going crazy, as this seems like an incredibly easy issue to solve, but:
I have the following:
UIImageView *bird = [[UIImageView alloc] initWithFrame:CGRectMake(130, -150, 50, 67)];
bird.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
[bird setImage:[UIImage imageNamed:@"tinylogo_night.png"]];
[scrollView addSubview:bird];
It works fine in portrait orientation, but in landscape orientation the image is at the original coordinates as well as the place where the flexible margins put it. What in the world am i not realizing here?
Edit: Here’s the rest:
- (void)scrollViewDidScroll_iPhone:(UIScrollView *)scrollView {
CGRect frm = navBar.frame;
CGPoint offset = scrollView.contentOffset;
frm.origin.y = -58-offset.y;
navBar.frame = frm;
if (dropdownBar && dropdownBarVisible) {
// MAYBETODO dynamically calculate position relative to navbar
frm = dropdownBar.frame;
frm.origin.y = -1-offset.y;
dropdownBar.frame = frm;
}
//scientific pulldown image
UIImageView *bird = [[UIImageView alloc] initWithFrame:CGRectMake(130, -150, 50, 67)];
[bird setImage:[UIImage imageNamed:@"tinylogo_night.png"]];
[scrollView addSubview:bird];
//end pulldown image
}
You appear to be adding another
UIImageViewsubview to your scroll view every time you receive thescrollViewDidScroll_iPhone:message. That really doesn’t sound like something you want to do.