【发布时间】:2013-06-21 07:02:25
【问题描述】:
我目前正在使用以下代码创建一个 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"。我了解当用户按“发送”时,可能无法锁定此文本或将其放入末尾。如果这些想法之一有解决方法,请告诉我。
但我有一个似乎更有可能的想法,我是否可以将光标从该文本的末尾移动到开头,以便用户更有可能将该文本留在那里。
如下图所示。第一个是现在的样子,第二个是我实现这个小想法时想要的样子。
这甚至可能吗?谢谢!
-亨利
【问题讨论】:
-
这实际上在启用 SLServiceTypeTwitter 时是可能的(不适用于 Facebook)。我在这里详细解释了:Prevent users from modifying part of the text in SLComposeViewController
标签: ios objective-c twitter cursor-position slcomposeviewcontroller