我刚刚将应用程序更新到 iOS 6,TWTweetComposeViewController
的 SetInitialText
函数已停止工作。 Composer 只是空虚。我正在使用 MonoTouch,有其他人看到过这个问题吗?相同的代码在我的 iOS 5 设备上仍然可以正常工作。
最佳答案
使用以下代码,这对我来说按预期工作:
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 已被弃用,您是否有该问题的示例代码?
关于iOS6:Twitter SetInitialText 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12664099/