別のクラス ファイルで何が起こっているかに基づいて、1 つのビューでアニメーションをトリガーしようとしています。メソッドにたどり着きます。これは、2 つのステートメントを吐き出しますが、NSLog
コミットはしないという事実によって裏付けられています。UIView Animation
コードは次のとおりです。
ViewController.h
@interface ViewController : UIViewController {
}
-(void)closeMenu;
ViewController.m
-(void)closeMenu{
//close the menu
NSLog(@"Got here");
[UIView animateWithDuration:0.6 animations:^{
[UIView setAnimationBeginsFromCurrentState:YES]; // so it doesn't cut randomly, begins from where it is
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[menuView setFrame:CGRectMake(menuView.frame.origin.x, -menuView.frame.size.height, menuView.frame.size.width, menuView.frame.size.height)];
}];
NSLog(@"Got here2");
}
OtherClass.m (コメントされたコードはこの質問とは無関係かもしれません。もちろん、実際のアプリケーションではまだ使用されています。理解を容易にするかもしれないと思いました)
#import "ViewController.h"
...
//- (void) item:(SDGroupCell *)item subItemDidChange:(SDSelectableCell *)subItem
//{
ViewController *foo = [[[ViewController alloc] init] autorelease];
//SelectableCellState state = subItem.selectableCellState;
//NSIndexPath *indexPath = [item.subTable indexPathForCell:subItem];
//switch (state) {
//case Checked:
//NSLog(@"Changed Sub Item at indexPath:%@ to state \"Checked\"", indexPath);
//close the menuView
[foo closeMenu];
//break;
//case Unchecked:
//NSLog(@"Changed Sub Item at indexPath:%@ to state \"Unchecked\"", indexPath);
//break;
//default:
//break;
//}
}