UIAlertViewのOtherButtonTitlesボタンを押してツイートを送信できるようにすることは可能ですか(はいの場合)?
私のコードは、「IBAction」でボタンを押すと計算を行い、その結果を「UIAlertView」の「メッセージ」として文字列で返します。「OtherButtonTitles」に2つ目のボタンを追加します。クリックすると、ネイティブのツイートページが表示されます。しかし、私はツイートを送信するためにボタンをリンクする方法がわかりません。
else{
NSString *str = [[NSString alloc] initWithFormat:@"You require an average GPA of at least %.2f to achieve your Goal of %@", gpagoal, (NSString *)[myPickerDelegate.myGoal objectAtIndex: [myPicker selectedRowInComponent:0]]];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Nothing is Impossible"
message:str
delegate:self
cancelButtonTitle:@"Good Luck"
otherButtonTitles:@"Tweet",nil];
//show alert
[alert show];
[alert release];
NSLog(@"All Valid");
}
それは次のようなものである必要があります
otherButtonTitles:@"Tweet", [self sendEasyTweet:(something here, dunno what to add)]];
「-(IBAction)sendEasyTweet:(id)sender」は、スタンドアロンのボタンでツイーターコンポーザーを呼び出すために作成したメソッドです。ただし、アプリの設計上、ツイーターボタンをスタンドアロンとしてではなくUIAlertViewで表示したいと思います。