首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >推特:推特SetInitialText不工作

推特:推特SetInitialText不工作
EN

Stack Overflow用户
提问于 2012-10-01 03:01:42
回答 1查看 419关注 0票数 0

我刚刚将我的应用程序更新到iOS 6,TWTweetComposeViewControllerSetInitialText功能已经停止工作。作曲家就会一无所获。我正在使用MonoTouch,还有没有人见过这个问题?同样的代码在我的iOS 5设备上仍然可以很好地工作。

EN

回答 1

Stack Overflow用户

发布于 2012-10-01 06:26:57

使用下面的代码,这对我来说是正常工作的:

代码语言:javascript
复制
var button2 = UIButton.FromType (UIButtonType.RoundedRect);
button2.Frame = new RectangleF (0f, 0f, 300f, 40f);
button2.SetTitle ("Tweet!", UIControlState.Normal);
button2.TouchUpInside += (sender, e) => {
    var tvc = new TWTweetComposeViewController ();
    tvc.SetInitialText ("Here is a tweet...");
    tvc.SetCompletionHandler ((result) => {
        if (result == TWTweetComposeViewControllerResult.Cancelled) {
            Console.WriteLine ("Cancelled sending the tweet!");
        } else {
            Console.WriteLine ("Tweet sent! hurrah!");  
        }
        this.DismissModalViewControllerAnimated (true);
    });
    this.PresentModalViewController (tvc, true);
};
View.AddSubview (button2);

尽管PresentModal和DismissModal已被弃用,但您有解决此问题的示例代码吗?

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12664099

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档