MainViewControllerからFlipsideViewControllerのクラスのloginメソッドをコールしたいのですが、
どのようにコードを記載したらいいのでしょうか。
同じレベルのメソッドをMainViewControllerに作らないとできないのでしょうか?
その場合、処理終了後によばれるA or Bのメソッドはどのように実装すればいいのでしょうか。
別クラスに同一メソッド名のものは作成できないという認識です。
ご回答よろしくお願いいたします。
MainViewController.m
@implementation MainViewController
loginをコールしたい★
@end
FlipsideViewController.m
@implementation FlipsideViewController
- (void)login {
MainViewController *controller = [[MainViewController alloc]initWithNibName:@"MainView" bundle:nil];
//初期化
controller.twitterEngine = [[XAuthTwitterEngine alloc] initXAuthWithDelegate:self];
controller.twitterEngine.consumerKey = kOAuthConsumerKey;
controller.twitterEngine.consumerSecret = kOAuthConsumerSecret;
self.delegate = nil;
NSString *username = usernameField.text;
NSString *password = passwordField.text;
//トークン取得
[controller.twitterEngine exchangeAccessTokenForUsername:username password:password];-->(A)or(B)がコール
}
//(A)トークン取得が成功
- (void) storeCachedTwitterXAuthAccessTokenString: (NSString *)tokenString forUsername:(NSString *)username
{
}
//(B)トークン取得が失敗
- (void) twitterXAuthConnectionDidFailWithError: (NSError *)error;
{
}
@end