gpt4 book ai didi

ios - 用户通过 iOS6 "tweet sheet"发推后触发一个 Action

转载 作者:行者123 更新时间:2023-11-28 20:18:43 24 4
gpt4 key购买 nike

我想在用户通过 iOS6 的内置“tweet sheet”发布推文后触发特定操作

Tweet Sheet

我想在用户点击“发送”按钮后触发一个方法。

或者,如果我可以从 iOS 收到一些关于推文已成功发布的确认信息,那么我想触发该方法。

这两个选项中的任何一个都可行吗?在用户发布推文后,是否有一种不同的首选方式来触发操作?

最佳答案

-(void)shareViewTwitter:(NSString*)str
{
TWTweetComposeViewController *twitter = [[TWTweetComposeViewController alloc] init];

// Optional: set an image, url and initial text

[twitter setInitialText:@"Some Text"];

// Show the controller
[self presentModalViewController:twitter animated:YES];

// Called when the tweet dialog has been closed (Here your Action will be triggered)
twitter.completionHandler = ^(TWTweetComposeViewControllerResult result)
{
NSString *title = @"Tweet Status";
NSString *msg;

if (result == TWTweetComposeViewControllerResultCancelled)
// Your Action

msg = @"Tweet compostion was canceled.";
else msg = @"Tweet composition completed."; // Your Action

// Show alert to see how things went...
UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title message:msg delegate:self cancelButtonTitle:@"Okay" otherButtonTitles:nil];
[alertView show];

// Dismiss the controller

[self dismissModalViewControllerAnimated:YES];

};

}

关于ios - 用户通过 iOS6 "tweet sheet"发推后触发一个 Action ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16825785/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com