私はUIViewにImageViewを持っています。ビューのキーボードサイズを移動しようとしていますが、UIImageViewではなくすべてのコンテンツが正しく移動します。UIViewを動かすと、同じビューでUIImageViewが動かないのはなぜですか?
-(void) keyboardWillShow:(NSNotification *) notification {
NSDictionary* keyboardInfo = [notification userInfo];
// Work out where the keyboard will be
NSValue* keyboardFrameBegin = [keyboardInfo valueForKey:UIKeyboardFrameBeginUserInfoKey];
CGRect keyboardFrameBeginRect = [keyboardFrameBegin CGRectValue];
// Work out animation duration
NSTimeInterval animationDuration =[[keyboardInfo valueForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue];
UIViewAnimationOptions keyboardAnimationCurve = [[keyboardInfo valueForKey:UIKeyboardAnimationCurveUserInfoKey] integerValue];
// Animate this
[UIView animateWithDuration:animationDuration
delay:0.0
options:keyboardAnimationCurve
animations:^(){
self.view.frame = CGRectOffset(self.view.frame, 0, -keyboardFrameBeginRect.size.height);
}
completion:NULL];
[UIImageView animateWithDuration:animationDuration
delay:0.0
options:keyboardAnimationCurve
animations:^(){
self.imgBankLogo.frame = CGRectOffset(self.imgBankLogo.frame, 0, -keyboardFrameBeginRect.size.height);
}
completion:NULL];
}
誰でも同じ問題がありましたか?私もUIImageを動こうとしましたが、動いていません。あなたが見ることができるように
はすべてがImageViewのを除いて移動します!
最初は答えとしてアニメーションは1つのみでしたが、移動する親ビューでは子ビューが移動しなかったので、私はそれを試しました! – Bernard
メインビュー内で別のビューを表示し、そのフレームを編集しようとします。メインビューのフレーム、つまりself.viewを編集しようとすると、問題が発生する可能性があります – TheMall