我在我的MainViewController中有以下一段代碼。這是最好的地方嗎?我有幾個其他方法具有類似的行爲。這種類型的代碼是否屬於單獨的類,僅用於UI轉換和操作?放置處理UI轉換和操作的代碼的最佳位置在哪裏?
-(void)slideView3P{
[self.view bringSubviewToFront:_view3P];
if (view3PIsMinimized){
view3PIsMinimized = NO;
[UIView beginAnimations:@"animationOff" context:NULL];
[UIView setAnimationDuration:0.5f];
[_view3P setFrame:CGRectMake(_view3P.frame.origin.x, 7, _view3P.frame.size.width, 446)];
[UIView commitAnimations];
}
else {
view3PIsMinimized = YES;
[UIView beginAnimations:@"animationOff" context:NULL];
[UIView setAnimationDuration:0.5f];
[_view3P setFrame:CGRectMake(_view3P.frame.origin.x, 57, _view3P.frame.size.width, 46)];
[UIView commitAnimations];
}
}
你剛剛做了一個從NSObject子類的類嗎? – AaronG
子類NSObject – TedCheng