在我的应用程序中,我有一个操作表,其中一个按钮以模态方式打开TWTweetComposeViewController。在iPhone模拟器上,鸣叫编辑器上的取消按钮正常工作并关闭视图。但是,在iPad模拟器上,取消按钮不起作用,tweet作曲者视图仍保留在屏幕上。它甚至更加怪异,因为在按下取消按钮后,键盘缩回并且底层视图变为活动状态。它表现得好像这个观点已被解散,但它仍然存在。TWTweetComposeViewController不会在iPad模拟器上解雇
的代码我使用时,用户按下操作按钮是:
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSString *buttonTitle = [actionSheet buttonTitleAtIndex:buttonIndex];
if ([buttonTitle isEqualToString:@"Open in Safari"]){
[[UIApplication sharedApplication] openURL:[self.webView.request URL]];
}else if ([buttonTitle isEqualToString:@"Twitter"]){
if ([TWTweetComposeViewController canSendTweet]){
TWTweetComposeViewController *tweetSheet = [[TWTweetComposeViewController alloc] init];
[tweetSheet addURL:[self.webView.request URL]];
tweetSheet.completionHandler = ^(TWTweetComposeViewControllerResult result){
if (result == TWTweetComposeViewControllerResultCancelled){
[self dismissModalViewControllerAnimated:YES];
}
};
[self presentModalViewController:tweetSheet animated:YES];
}else {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Twitter error" message:@"You can't send a tweet right now, make sure your device has an internet connection and you have at least one Twitter account setup" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
}
}
}
你有关于如何解决这个问题,或者是它的模拟器中的错误任何想法?
P.S .:我的应用程序是一个tabbar应用程序,此代码从标签栏的视图控制器之一调用。
更新Xcode和iOS版SDK到最新版本后,它现在工作正常。 – Luiz 2012-04-25 15:12:52