我有这样回的解决方案,但我不认为这是最好的一个,并保持记住这只是一个解决方法。
第一件事要做的就是设置你的global
背景,如:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
..
self.window.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"blur.jpeg"]];
return YES;
}
blur.jpeg
是我使用这个例如(得到它从谷歌)清晰(不模糊)图像
接下来是子类UIViewController
全球使用,但它取决于你如何实现全球。
//BGBlurViewController.h
//
@interface BGBlurViewController : UIViewController
@end
//BGBlurViewController.m
//
@implementation BGBlurViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
UIToolbar *background = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
[background setBarStyle:UIBarStyleBlackTranslucent];
[self.view addSubview:background];
[self.view sendSubviewToBack:background];
}
@end
我使用UIToolbar
为UIViewController
背景,达到虚化效果。
这是如何使用的子类UIViewController
(BGBlurViewController)
//RootViewController
//
#import "BGBlurViewController.h"
@interface ViewController : BGBlurViewController
@end
和另:
//View next to rootViewController
//
#import "BGBlurViewController.h"
@interface ViewController2 : BGBlurViewController
@end
注: 我设置UIViewController
S的的backgroundColor(视图控制器和ViewController2)到Default
/无故事板,这也只是一种解决方法...
这是在运行时的输出样本:
希望这会帮助你..干杯..
您必须添加背景在AppDelegate.m窗口在-didFinishLaunching里面。 – 0yeoj
@ 0yeoj谢谢你,但那不是我真正的问题。我编辑了我的问题,以便您更好地理解我的问题。 – FTFT1234
啊..我看到..你有没有尝试在'-viewWillDisappear'里面设置'self.view.alpha = 0'? – 0yeoj