我目前正在使用以下代码创建一个SLComposeViewController ..。
- (IBAction)compose:(id)sender {
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
SLComposeViewController *composeViewController = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[composeViewController setInitialText:@"Status from DummyCode.com"];
[composeViewController setCompletionHandler:^(SLComposeViewControllerResult result) {
if (result == SLComposeViewControllerResultDone) {
UIAlertView *success = [[UIAlertView alloc] initWithTitle:@"Success" message:@"Your status was successfully posted!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[success show];
}
else {
[self dismissViewControllerAnimated:YES completion:nil];
}
}];
[self presentViewController:composeViewController animated:YES completion:nil];
} else {
UIAlertView *error = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Error" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[error show];
}
}我有一个想法,我想要实现到我的应用程序。我想把"- DummyCode.com/social-media-app“保留到每条推文的末尾。据我所知,当用户按下“发送”键时,可能不可能锁定该文本或将其放在末尾。如果有一个解决办法,请告诉我这些想法。
但我有一个更有可能的想法,我是否有可能把光标从文本的末尾移到开头,这样用户就更有可能把文本放在那里。
如下图所示。第一个问题是它现在是怎样的,第二个问题是当我实现这个小想法时,我希望它是怎样的。


这有可能吗?谢谢!
-Henry
发布于 2013-06-24 17:38:01
你有没有考虑过,一旦用户输入了自己的推特,就追加文本?如:
NSString *initialText = @"Status from DummyCode.com";
initialText = [initialText stringByAppendingString:@"DummyCode.com/social-media"];
[composeViewController setInitialText:initialText];您可能需要检查tweet的长度,减去您正在添加的字符串的长度,即140-25。
https://stackoverflow.com/questions/17281125
复制相似问题