0

だから私は質問があります。メソッドを呼び出す(プロトコル)ためのこのコード行の問題を誰かに教えてもらえますか

 [self.delegate poplogin];

poploginはメソッド名であり、何らかの理由で機能しません。メソッドpoploginを呼び出さない

参考のために :

@property(nonatomic,retain) id<loginAuthDelegate> delegate;

だから私はケースを説明させてください

だから私はクラスabc.hを持っているとしましょう

@protocol loginAuthDelegate <NSObject>
-(void)poplogin;
@end

インターフェース後

@property(nonatomic,retain) id<loginAuthDelegate> delegate;

in .m i am just calling the Delegate and @synthesize it
[self.delegate poplogin];

not i have another files
let say def.h
i am importing the Class abc.h
@interface def : UIViewController<loginAuthDelegate>



def.m
-(void)poplogin
{
NSLog(@"Delegate doesn't respond to here");
vmpaSecureLogin *ivc = [[vmpaSecureLogin alloc] init];
ivc.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:ivc animated:YES];
}
4

1 に答える 1

2

これはおそらくself.delegateですnil

delegateViewControllerなど、デリゲートメソッドを実装した他のオブジェクトにオブジェクトを影響させるのを忘れた可能性があります。

于 2012-10-03T16:49:40.817 に答える