私はUIButton
自分の見解のどこかにあります。ボタンのタッチイベントでUIView
登場します。UIAnimation
私が使用したのは、ウィンドウの上部からビューを表示するためです。しかし、button.frame.origin.yから表示したいのですが。ボタンに触れる前は、ビューは表示されません。ボタンをタッチすると、上の位置からビューが表示され始めます。
コードは次のとおりです。
-(IBAction) ShowInfowView:(id)sender{
CGRect rect = viewInfo.frame;
rect.origin.y = rect.size.height - rect.size.height+58.0;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.70];
[UIView setAnimationDelay:0.0];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
viewInfo.frame = rect;
[UIView commitAnimations];
}
これは私が再びビューを隠す方法です:
-(IBAction) HideInfoView:(id)sender{
CGRect rect = viewInfo.frame;
rect.origin.y = -rect.size.height;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.70];
[UIView setAnimationDelay:0.0];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
viewInfo.frame = rect;
[UIView commitAnimations];
}
viewDidLoadで私は次のことをしています:
CGRect rect = viewInfo.frame;
rect.origin.y = -rect.size.height;
viewInfo.frame = rect;
更新:
この例をご覧ください。ここでは、画面の上からビューが表示されています。ボタンのy軸から表示したい。そのことについては、ボタンyの位置を少し上に向けることを検討してください。