【问题标题】:iOS6: Twitter SetInitialText Not WorkingiOS6:Twitter SetInitialText 不工作
【发布时间】:2012-09-21 18:15:13
【问题描述】:

我刚刚将我的应用程序更新到 iOS 6,TWTweetComposeViewControllerSetInitialText 功能已停止工作。作曲家只是空空如也。我正在使用 MonoTouch,有其他人看到这个问题吗?相同的代码在我的 iOS 5 设备上仍然可以正常工作。

【问题讨论】:

    标签: ios twitter xamarin.ios ios6


    【解决方案1】:

    这对我来说可以使用以下代码:

    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 已被弃用,您是否有任何问题的示例代码?

    【讨论】:

    • 谢谢你的例子,我已经通过直接实例化 TWTweetComposeViewController 而不是在新的视图控制器中实现它来解决问题。
    • 随意将问题标记为已回答,以便其他人知道该问题已成功响应:)
    猜你喜欢
    • 2018-09-23
    • 1970-01-01
    • 2012-09-18
    • 1970-01-01
    • 2012-09-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多