1

Facebookで共有するためにDEFacebookComposeViewControllerを使用しています。

1つのViewControllerで問題が発生し、ビューの背景色が透明な黒の背景ではなく白に変更されます。白い背景の問題

4

2 に答える 2

3

コードのどこにも変更を加える必要はありません。実装モジュールでこのコードを置き換えるだけです。

self.modalPresentationStyle = UIModalPresentationCurrentContext;

appDelegate.window.rootViewController.modalPresentationStyle = UIModalPresentationCurrentContext;

そして、あなたの仕事は終わります。

于 2013-02-18T09:03:31.610 に答える
0

私はなんとか問題を修正することができました。次のファイルのコードのコメントを解除する必要があります: "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];

   }

彼らが同様の問題を見つけた場合、これが他の人に役立つことを願っています。

ありがとう。

于 2012-10-10T17:11:01.080 に答える