계산 결과를 표시하려는 모달 뷰가 있습니다. 모든 iOS7보기를 만들기 위해 blured 배경을 가진 팝업보기로 채색 된 배경을 원합니다.UIImage + ImageEffects가 장치에서 작동하지 않습니다.
사과에서 "UIImage + ImageEffects .h/m"파일을 사용하여 작업 할 수있었습니다.
이 모달 뷰의 viewDidLoad에 있습니다 :
- (void)viewDidLoad {
[super viewDidLoad];
/* How it works
self.image is a screenshot of the VC presenting the modal view
1- we set the background as the screenshot of the previous viewControler
2- we hide the popup view
3- we set the background of the popup as a blured snapshot of its container view (self.view)
4- we unhide the popup view and set its radius
5- we create a tinted version of the background image (what we got from the previous view controller
6- we set the background of self.view to the tinted version
*/
// *** 1 ***
self.view.backgroundColor=[UIColor colorWithPatternImage:self.image];
// *** 2 ***
self.containerView.hidden=YES;
// *** 3 ***
UIImage *pepe=[self bluredImageFromView:self.containerView withBackground:self.view withBackgroundTintColor:[UIColor colorWithWhite:1 alpha:0.75]];
self.containerView.backgroundColor=[UIColor colorWithPatternImage:pepe];
// *** 4 ***
self.containerView.hidden=NO;
self.containerView.layer.cornerRadius=4.5f;
// *** 5 ***
UIImage *tintedBackground =[self.image applyBlurWithRadius:0
tintColor:[UIColor colorWithRed:0.85 green:0.85 blue:0.85 alpha:0.35]
saturationDeltaFactor:1.8
maskImage:nil];
// *** 6 ***
self.view.backgroundColor=[UIColor colorWithPatternImage:tintedBackground];
}
는 시뮬레이터에 아주 잘 작동하지만 아이폰 (4S) onmy 시도 할 때 모달 뷰를 제시 할 때, 나는 검은있어 화면. 오류 없음, 콘솔에서 불평하지 않음, 아무런 의미가 없습니다.
의견이 있으십니까? 그것은 시뮬레이터 self.image에 그 보인다
하는 반면, 장치 거기에 nil이 아닌 viewDidLoad에
의 맨 처음에if (!self.image) NSLog (@"self.image is empty");
:
편집
나는 코드를 추가 입니다. 부모 VC에서을 prepareForSegue에서 self.image를 인스턴스화하려고했지만 작동하지 않습니다.
고맙습니다. 나는 실제로 레이 웬델 리히트의 튜토리얼에서 스 니프 코드 (snip code)를 받아 냈습니다. 여러분이 지적한이 스레드에 관한 것입니다. 당신이 제공하는이 코드로 제 방법을 수정했는데 이제는 매력처럼 작동합니다. 나는 너에게 충분히 감사 할 수 없다! – Marcal
반갑습니다. 'applyBlurWithRadius : tintColor : saturationDeltaFactor : maskImage :'가 iPhone 4에서 작동하는지 궁금 할 것입니다. –
제 4로만 완벽하게 작동한다고 말할 수 있습니다. 앱을 제출하기 전에 며칠 내 iPad 3에서 시험해 보겠습니다. – Marcal