我们已经成功地将UIVibrancyEffect和UIVisualEffectView集成到我们的应用程序中,但我注意到它的活力并不像我想的那么强烈,而且文本比我见过的演示更暗淡.我找不到任何方法来调整它,或以任何方式影响它.我认为这可能是因为我们使用的是自定义字体,但我也尝试过,字体较粗但看起来仍然很暗淡.有任何想法吗?
使用我们的自定义字体Open Sans Light:

使用系统字体:

这是代码:
UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
UIVisualEffectView *blurEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
[blurEffectView setFrame:self.viewController.view.bounds];
UIVisualEffect *vibrancyEffect = [UIVibrancyEffect effectForBlurEffect:blurEffect];
UIVisualEffectView *vibrancyEffectView = [[UIVisualEffectView alloc] initWithEffect:vibrancyEffect];
[vibrancyEffectView setFrame:self.viewController.view.bounds];
[blurEffectView.contentView addSubview:vibrancyEffectView];
UITextView *messageText = [[UITextView alloc] initWithFrame:CGRectMake(0,0,320,568)];
[messageText setFont:[CLAppearanceManager fontForLabelType:CLAppearanceLabelFontWaveMessageEntry]];
[messageText setTextColor:[UIColor whiteColor]];
messageText.layer.shadowColor = [[UIColor blackColor] CGColor];
messageText.layer.shadowOffset = CGSizeMake(1.0,1.0);
messageText.layer.shadowRadius = 3.0;
[messageText setBackgroundColor:[UIColor clearColor]];
if(self.messageLabel.text && self.messageLabel.text.length>0) {
[messageText setText:self.messageLabel.text];
} else {
[messageText setText:@"no message"];
}
[messageText setTextAlignment:NSTextAlignmentCenter];
[messageText setEditable:NO];
[messageText addObserver:self forKeyPath:@"contentSize" …Run Code Online (Sandbox Code Playgroud) 在尝试在iOS 8键盘扩展中使用SpriteKit时,我遇到了许多崩溃,这些崩溃只发生在使用物理设备而未连接到调试器时.
如果调试器连接到设备,或者如果在SIM卡中运行,一切都很可爱.
当没有连接调试器时,我相信扩展的生命周期略有不同,有时候键盘扩展会背景化,导致OpenGL崩溃.
苹果技术说明中描述了我们遇到的崩溃.它位于函数gpus_ReturnNotPermittedKillClient中,并且Apple声明它出现是因为您无法在后台运行OpenGL,并建议使用App Delegate回调来暂停您的OpenGL活动.
由于这是键盘扩展,因此没有应用程序委托.相反,我们尝试注册app委托生命周期通知:没有运气 - 他们不会开火.所以我们尝试使用viewcontroller生命周期回调,它仍然无法解决问题.
当这次崩溃发生时,我们是活跃的键盘,并且只是围绕SpriteKit/SKView和UIImage操作做了很多事情,没有明显的理由我们为什么会背景,但是这种崩溃发生了.如果我们真正做到背景,似乎也会发生同样的崩溃.
最后,我试图弄清楚如何知道我们正在进行背景化,并且我们需要暂停OpenGL.
这是完整的堆栈:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000001
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.spritekit.renderQueue
Thread 0 Crashed:
0 libGPUSupportMercury.dylib 0x000000018e89a18c gpus_ReturnNotPermittedKillClient + 12
1 libGPUSupportMercury.dylib 0x000000018e89b124 gpusSubmitDataBuffers + 160
2 GLEngine 0x0000000189a10260 gliPresentViewES_Exec + 192
3 GLEngine 0x0000000189a10164 gliPresentViewES + 80
4 OpenGLES 0x0000000189a1fc7c -[EAGLContext presentRenderbuffer:] + 68
5 SpriteKit 0x000000018a51c4a4 -[SKView _renderContent] + 1028
6 libdispatch.dylib 0x0000000196c8d368 _dispatch_client_callout + 12
7 …Run Code Online (Sandbox Code Playgroud)