在横向时复制UIImageView?

时间:2012-02-02 03:25:23

标签: objective-c ios uiimageview orientation

我想我会发疯,因为这似乎是一个非常容易解决的问题,但是:

我有以下内容:

    UIImageView *bird = [[UIImageView alloc] initWithFrame:CGRectMake(130, -150, 50, 67)];
bird.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
[bird setImage:[UIImage imageNamed:@"tinylogo_night.png"]];
[scrollView addSubview:bird];

它在纵向方向上工作正常,但在横向方向上,图像位于原始坐标以及灵活边距所在的位置。我在世界上没有意识到什么?

编辑:其余的是:

- (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

}

1 个答案:

答案 0 :(得分:2)

每次收到UIImageView消息时,您似乎都会在滚动视图中添加另一个scrollViewDidScroll_iPhone:子视图。这听起来不像你想做的事。