- (IBAction)postToTwitter:(id)sender {
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
{
SLComposeViewController *tweetSheet = [SLComposeViewController
composeViewControllerForServiceType:SLServiceTypeTwitter];
[tweetSheet setInitialText:@"This is the text which should be called from switch case"];
[self presentViewController:tweetSheet animated:YES completion:nil];
}
}
////这是我的转换案例,只是为了给你一个想法
-(IBAction) random {
int text = arc4random() % 3;
switch (text) {
case 0:
textview.text = @"Text example 1";
break;
case 1:
textview.text = @"Text example 2";
break;
case 2:
textview.text = @"Text example 3";
break;
default:
break;
}
}
我想在切换案例发生变化时,将文本示例1,文本示例2和文本示例3输入到我的Twit内容中。 请帮忙!!! :'(
答案 0 :(得分:0)
只需用
替换它[controller setInitialText:textview.text];