静的メソッドの実装でセレクターを呼び出すにはどうすればよいですか?
これを試しましたが、成功しませんでした。私は何を間違っていますか?
WhiteScreenFader.m
+(void) fadeIn:(float)duration inView:(UIView *)view withAction:(SEL)selector
{
.
.
.
[NSObject performSelector:selector]; //??
}
ViewController.m
// I call static method like this
[WhiteScreenFader fadeIn:1.0 inView:self.view withAction:@selector(segue:)];
--- 更新 ここに完全な実装があります
+(void) fadeIn:(float)duration inView:(UIView *)view withAction:(SEL)selector
{
// bielu uiview
UIView *whiteView = [[UIView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame];
[whiteView setAutoresizingMask:UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth];
[whiteView setBackgroundColor:[UIColor whiteColor]];
whiteView.alpha = 0;
[view addSubview:whiteView];
// fade to 0
[UIView animateWithDuration:duration delay:0 options:UIViewAnimationCurveEaseOut animations:^{
whiteView.alpha = 1;
} completion:^(BOOL finished){
[NSObject performSelector:selector];
}];
}