0
メソッドをパラメータとして渡して後で実行する方法を学習しようとしています。私のコードでは、ボタン(最後のメソッド)をクリックしたときに呼び出されるメソッドがあります。メソッド1とメソッド2をメソッドplaceSlideに渡そうとしています。私はそれを行うことができますが、私はそれらを実行しようとするとエラーが発生します。私は間違って何をしていますか?私は取得していますパラメータとして渡されたときにメソッドを実行できませんiPhone/iPad
-(void) method1{
}
-(void) method2{
}
-(void) placeSlide: (SEL) meth1 OtherMethod: (SEL) meth2{
NSTimer *timer1;
timer1 = [NSTimer scheduledTimerWithTimeInterval: (1)
target: self
selector: @selector(meth1)
userInfo: nil
repeats: NO];
NSTimer *timer2;
timer2 = [NSTimer scheduledTimerWithTimeInterval: (1.2)
target: self
selector: @selector(meth2)
userInfo: nil
repeats: NO];
}
// get's executed when I click on a btn
-(IBAction) ButtonClick{
[self placeSlide:@selector(method1) OtherMethod:@selector(method2)];
}
と誤差がある:彼らがそうであるように
どのようなエラーが表示されますか? – ColdLogic