我試圖讓我的UIScrollView
佔用所有的屏幕,有它內部的圖像,用戶可以縮放,平移等,這所有的作品。但是,當用戶點擊屏幕一次時,我想要在此UIScrollView
的頂部顯示一個附加視圖,並提供有關該圖片的一些信息。問題是無論我做什麼,UIScrollView
的孩子ImageView總是在最前面。我試圖改變xib中的視圖的順序,我嘗試使用bringSubViewToFront
沒有成功。下面是代碼:UIScrollView的內容總在最前面
- (void)viewDidLoad {
[super viewDidLoad];
UITapGestureRecognizer *singleTapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(flipViewSingleTap:)];
singleTapGesture.delegate = self;
self.flippedImage.userInteractionEnabled = YES;
[self.flippedImage addGestureRecognizer:singleTapGesture];
[singleTapGesture release];
self.flippedImageView.contentSize = CGSizeMake(1024, 768);
self.flippedImageView.delegate = self;
self.flippedMenuView.alpha = 0.0f;
}
- (IBAction)flipViewSingleTap:(UIGestureRecognizer *)sender {
flipItemsVisible = !flipItemsVisible;
[self.view bringSubviewToFront:self.flippedMenuView];
[UIView animateWithDuration:0.5f
delay:0.0f
options:UIViewAnimationCurveEaseInOut
animations:^{
self.flippedMenuView.alpha = flipItemsVisible ? 1.0f : 0.0f
}
completion:nil];
}
感謝您的建議,但這並不能幫助。如果我加入flippedMenuView作爲的UIScrollView的一個子視圖,它從屏幕上平移遠離了如果用戶在放大。我將它作爲頂部的獨立觀點的一點是要在運動方面,它「靜態」。 – bolshas