当你调用以下twitter
方法时,我总是会在上面找到一个奇怪的缩进。
以下是我的方法:
- (void)twitter {
if ([TWRequest class]) {
TWTweetComposeViewController *twitter = [[TWTweetComposeViewController alloc] init];
[twitter setInitialText:titleDetail];
[twitter addImage:imgPreview];
[twitter addURL:[NSURL URLWithString:linkPost]];
[self presentViewController:twitter animated:YES completion:nil];
twitter.completionHandler = ^(TWTweetComposeViewControllerResult res) {
if (res == TWTweetComposeViewControllerResultDone) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Выполнено" message:@"Ваш твит успешно опубликован" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
} else if (res == TWTweetComposeViewControllerResultCancelled) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Ошибка" message:@"Ваш твит неопубликован" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
}
[self dismissModalViewControllerAnimated:YES];
};
}
}
我该如何解决这个问题?
问题是: 当应用程序加载(显示启动画面)时,我隐藏了状态栏。
状态栏最初是隐藏的。
然后,在 AppDelegate.m
:
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:NO];
[UIApplication sharedApplication].keyWindow.frame = CGRectMake(0, 20, 320, 460);
问题恰恰出在20
:
CGRectMake (0, 20, 320, 460);
答案 0 :(得分:0)
问题在于:当加载应用程序(显示启动画面)时,我隐藏了状态栏。
Status bar is initially hidden YES
然后,在AppDelegate.m中:
[[UIApplication sharedApplication] setStatusBarHidden: NO withAnimation: NO];
[UIApplication sharedApplication]. KeyWindow.frame = CGRectMake (0, 20, 320, 460);
问题正好在20:
CGRectMake (0, 20, 320, 460);