ユーザーがクリックしたときに画面のサイズに自動的にズームしたい UIView があります。
http://cocoawithlove.com/2010/09/zoomingviewcontroller-to-animate-uiview.htmlからコードを取得しました
ズームが機能しますが、ズームが始まる直前にビューが 90 度回転します。なぜそれが起こっているのですか?
(ビューはカルーセル内にあります。ユーザーがビューをタップする前に、デバイスが横向きに回転し、その時点でカルーセルのビュー コントローラーがナビゲーション スタックにプッシュされ、カルーセルが表示されます。)
コードは次のとおりです。
- (void)buttonTapped:(UIButton *) sender
{
NSInteger index = [self.carousel indexOfItemView:sender];
UIView *currentView = [self.carousel itemViewAtIndex: index];
UIView *proxyView = [[UIView alloc] initWithFrame:currentView.frame];
proxyView.hidden = YES;
proxyView.autoresizingMask = currentView.autoresizingMask;
[currentView.superview addSubview: proxyView];
CGRect frame = [currentView.window convertRect:currentView.frame fromView:proxyView.superview];
[currentView.window addSubview:currentView];
currentView.frame = frame;
[UIView
animateWithDuration:2.4
animations:^{
currentView.frame = currentView.window.bounds;
}];
(カルーセルは、 https://github.com/nicklockwood/iCarouselからの UIView 派生オブジェクトです)
ありがとう