Facebook에서 공유하기 위해 DEFacebookComposeViewController를 사용하고 있습니다.iphone sdk에서 DEFacebookComposeViewController를 사용하는 흰색 배경 문제
하나의보기 컨트롤러에서 문제가 발생하여 투명한 검은 색 배경 대신보기의 배경색을 흰색으로 변경합니다.
Facebook에서 공유하기 위해 DEFacebookComposeViewController를 사용하고 있습니다.iphone sdk에서 DEFacebookComposeViewController를 사용하는 흰색 배경 문제
하나의보기 컨트롤러에서 문제가 발생하여 투명한 검은 색 배경 대신보기의 배경색을 흰색으로 변경합니다.
문제를 해결할 수있었습니다. "DEFacebookComposeViewController.h"
그냥 다음 코드 교체 :
(무효) viewWillAppear : { [슈퍼 viewWillAppear 애니메이션 (BOOL)를 : 당신은 다음과 같은 파일의 코드 주석을 해제 할 필요가 애니메이션 ];
// 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];
}
희망.
감사합니다.
그냥
appDelegate.window.rootViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
로 구현 모듈
self.modalPresentationStyle = UIModalPresentationCurrentContext;
이 코드를 교체하고 작업이 완료 B 것, 어디서나 코드를 변경할 필요가 없습니다.
이 문제가 해결되었습니다. 내가 처음에 그 원인을 이해했으면 좋겠다. –
사실 그 라인이 잘못되었습니다. IT는 코드 내부 viewcontroller입니다. 외부 구현을위한 NOt입니다. –
추가 된 하위 뷰에서 viewController를 밀 때이 문제가 발생합니다.이 뷰는 정상적으로 작동합니다. –