這裏查看過渡口吃是一種過渡的代碼我有顯示ViewB從ViewA當鍵盤出現的iOS
CGPoint c = thepoint;
CGFloat tx = c.x - floorf(theview.center.x) + 10;
CGFloat ty = c.y - floorf(theview.center.y) + 100;
[UIView animateWithDuration:0.5
delay:0.0
options:UIViewAnimationOptionCurveEaseOut
animations:^{
// Transforms
CGAffineTransform t = CGAffineTransformMakeTranslation(tx, ty);
t = CGAffineTransformScale(t, 0.1, 0.1);
theview.transform = t;
theview.layer.masksToBounds = YES;
[theview setTransform:CGAffineTransformIdentity];
}
completion:^(BOOL finished) {
}];
現在過渡去沒有問題,很順利。
當我在我的ViewB中,我有一個默認焦點的文本框。 (在viewDidAppear
)
-(void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:NO];
[self performSelector:@selector(focusCommentText) withObject:nil afterDelay:0.5];
}
- (void) focusCommentText {
[self focusTextbox:commentText];
}
- (void) focusTextbox : (UITextView *) textView{
@try {
[ textView becomeFirstResponder];
}
@catch (NSException *exception) {
}
}
轉型與鍵盤來了..發生在同一時間。而現在略顯尷尬。有人能幫我一下嗎?
這只是意味着這兩個動畫不能與當前一代的硬件性能良好同時運行。你需要找到一種方法,不要同時做這兩個動畫。 –
@AbhiBeckert你是對的!我按照你的說法修復了我的代碼。我也將它作爲新的答案發布。謝謝你的幫助! –
如果這就是你最終做的你應該將其標記爲你接受的答案,而不是馬特的答案。 –