Facebookで共有するためにDEFacebookComposeViewControllerを使用しています。
1つのViewControllerで問題が発生し、ビューの背景色が透明な黒の背景ではなく白に変更されます。
Facebookで共有するためにDEFacebookComposeViewControllerを使用しています。
1つのViewControllerで問題が発生し、ビューの背景色が透明な黒の背景ではなく白に変更されます。
コードのどこにも変更を加える必要はありません。実装モジュールでこのコードを置き換えるだけです。
self.modalPresentationStyle = UIModalPresentationCurrentContext;
と
appDelegate.window.rootViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
そして、あなたの仕事は終わります。
私はなんとか問題を修正することができました。次のファイルのコードのコメントを解除する必要があります: "DEFacebookComposeViewController.h"
次のコードを置き換えるだけです。
(void)viewWillAppear:(BOOL)animated {[super viewWillAppear:animated];
// Take a snapshot of the current view, and make that our background after our view animates into place.
// This only works if our orientation is the same as the presenting view.
// If they don't match, just display the gray background.
if (self.interfaceOrientation == self.fromViewController.interfaceOrientation) {
// UIImage *backgroundImage = [self captureScreen];
// self.backgroundImageView = [[[UIImageView alloc] initWithImage:backgroundImage] autorelease];
}
else {
// self.backgroundImageView = [[[UIImageView alloc] initWithFrame:self.fromViewController.view.bounds] autorelease];
}
// self.backgroundImageView.autoresizingMask = UIViewAutoresizingNone;
// self.backgroundImageView.alpha = 0.0f;
// self.backgroundImageView.backgroundColor = [UIColor lightGrayColor];
// [self.view insertSubview:self.backgroundImageView atIndex:0];
// Now let's fade in a gradient view over the presenting view.
self.gradientView = [[[DEFacebookGradientView alloc] initWithFrame:[UIApplication sharedApplication].keyWindow.bounds] autorelease];
self.gradientView.autoresizingMask = UIViewAutoresizingNone;
self.gradientView.transform = self.fromViewController.view.transform;
self.gradientView.alpha = 0.0f;
self.gradientView.center = [UIApplication sharedApplication].keyWindow.center;
[self.fromViewController.view addSubview:self.gradientView];
[UIView animateWithDuration:0.3f
animations:^ {
self.gradientView.alpha = 1.0f;
}];
self.previousStatusBarStyle = [UIApplication sharedApplication].statusBarStyle;
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque animated:YES];
[self updateFramesForOrientation:self.interfaceOrientation];
}
このコードで:
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
// Take a snapshot of the current view, and make that our background after our view animates into place.
// This only works if our orientation is the same as the presenting view.
// If they don't match, just display the gray background.
if (self.interfaceOrientation == self.fromViewController.interfaceOrientation) {
UIImage *backgroundImage = [self captureScreen];
self.backgroundImageView = [[[UIImageView alloc] initWithImage:backgroundImage] autorelease];
}
else {
self.backgroundImageView = [[[UIImageView alloc] initWithFrame:self.fromViewController.view.bounds] autorelease];
}
self.backgroundImageView.autoresizingMask = UIViewAutoresizingNone;
self.backgroundImageView.alpha = 0.0f;
self.backgroundImageView.backgroundColor = [UIColor lightGrayColor];
[self.view insertSubview:self.backgroundImageView atIndex:0];
// Now let's fade in a gradient view over the presenting view.
self.gradientView = [[[DEFacebookGradientView alloc] initWithFrame:[UIApplication sharedApplication].keyWindow.bounds] autorelease];
self.gradientView.autoresizingMask = UIViewAutoresizingNone;
self.gradientView.transform = self.fromViewController.view.transform;
self.gradientView.alpha = 0.0f;
self.gradientView.center = [UIApplication sharedApplication].keyWindow.center;
[self.fromViewController.view addSubview:self.gradientView];
[UIView animateWithDuration:0.3f
animations:^ {
self.gradientView.alpha = 1.0f;
}];
self.previousStatusBarStyle = [UIApplication sharedApplication].statusBarStyle;
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque animated:YES];
[self updateFramesForOrientation:self.interfaceOrientation];
}
彼らが同様の問題を見つけた場合、これが他の人に役立つことを願っています。
ありがとう。