5
一度ユーザーが完了したら何かしたいとします。職業はなんですか?なぜSLComposeViewControllerに代理人がいないのですか?
デリゲートはありません。現在のビューコントローラを一旦解除すると、何をすべきか?
一度ユーザーが完了したら何かしたいとします。職業はなんですか?なぜSLComposeViewControllerに代理人がいないのですか?
デリゲートはありません。現在のビューコントローラを一旦解除すると、何をすべきか?
Appleのドキュメントでは、SLComposeViewControllerにデリゲートではなく補完ハンドラプロパティがあることがわかります。 setCompletionHandlerメソッドを使用してそのプロパティを設定するだけで済みます。次に、SLComposeViewControllerResult定数を使用して、投稿が投稿またはキャンセルされたかどうかを回復し、それに応じてアクションを実行します。
-(void) shareToFacebook {
//1. Set link and image
NSString *appLink = @"https://itunes.apple.com/app/id989793966";
UIImage *twitterImage = [UIImage imageNamed:@"TF_400x400.png"];
//2. Check if we can share
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
//3. Compose the share view controller
SLComposeViewController *FBViewController = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[FBViewController addURL:[NSURL URLWithString:appLink]];
[FBViewController addImage:twitterImage];
//4 Set completion handler and define actions to take
[FBViewController setCompletionHandler:^(SLComposeViewControllerResult result)
{
if (result == SLComposeViewControllerResultCancelled) {
[self addEmptyScreenButtonTargets];
} else if (result == SLComposeViewControllerResultDone) {
//Unlock words; show thank you screen
[NewCardManager unlockWordsForPackage:4];
[self openFBThankYouScreen];
}
}];
//5. Call to modally present the share controller
[self presentViewController:FBViewController animated:YES completion:nil];
}
}完了ハンドラが何のためにあるのかだ
。 –
ああ私はそれを逃した。今、彼らは代理人の代わりにそれを使用します。 –