在集成twitter框架时,如何使提交不可编辑?

时间:2013-02-24 22:15:07

标签: xcode twitter uitextfield

我有一个游戏,用户可以将分数提交给Twitter。问题是,现在,他们能够输入他们想要的东西而不是他们的实际分数。通过使TextField无法编辑,他们将无法更改其分数。

任何人都知道解决这个问题吗?

这是代码的snippit(显然也应用了twitter框架):

-(IBAction)twitter {

float currentTime = [seconds.text floatValue];
float newTime = currentTime;

NSString *twitter = [NSString stringWithFormat:@"I finished level 2 of #TextOff in %.2f seconds! Think you can beat my score? Download it in the App Store now!", newTime];

TWTweetComposeViewController *tweet = [[TWTweetComposeViewController alloc] init];
[tweet setInitialText:twitter];

//am i able to get ride of the textfield here?????

[self presentModalViewController:tweet animated:YES];

}

1 个答案:

答案 0 :(得分:0)

如果您想使用用户的Twitter帐户发布帖子,他们使用他们的设备设置而不显示对话框或允许他们更改任何内容使用社交框架的SLRequest类。这将允许您向Twitter发出请求,而不必使用内置的Twitter组合对话框。

注意,你必须将[ACAccountStore requestAccessToAccountsWithType:options:completion:]包含在{{1}}中,所以最好至少给它们一些关于你在警告提示之前或之后做什么的指示,否则它看起来很可疑。