[TIMOB-23778] iOS: Improve warning when calling iOS10 visual effects for Ti.UI.iOS.BlurView on < iOS10
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Low |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-08-15T23:58:56.000+0000 |
Affected Version/s | Release 5.5.0 |
Fix Version/s | Release 5.5.0 |
Components | iOS |
Labels | qe-5.5.0 |
Reporter | Harry Bryant |
Assignee | Hans Knöchel |
Created | 2016-08-15T20:52:25.000+0000 |
Updated | 2016-08-16T20:24:18.000+0000 |
Description
Two new visual effects for iOS10 were exposed for Ti.UI.iOS.BlurView:
Ti.UI.iOS.BLUR_EFFECT_STYLE_REGULAR
Ti.UI.iOS.BLUR_EFFECT_STYLE_PROMINENT
Currently, when running an app with these styles on a device < iOS10, the following error is returned:
[ERROR] Invalid type passed to function. expected: Number, was: NSNull -[TiUIiOSBlurView setEffect_:] (TiUIiOSBlurView.m:43)
It would be beneficial to handle this better through the form of a warning, stating that the currently selected style is not supported for the current iOS version.
TEST CODE:
var win = Ti.UI.createWindow({
backgroundColor: "#fff"
});
// Reference image (or view)
var img = Ti.UI.createImageView({
image: "/default_app_logo.png",
top: 100,
width: 300,
height: 300
});
// Blur view
var blur = Ti.UI.iOS.createBlurView({
width: Ti.UI.FILL,
height: Ti.UI.FILL
});
img.add(blur);
// Effect controls
var tabs = Ti.UI.iOS.createTabbedBar({
labels: ["Extra light", "Light", "Dark", "Regular", "Prominent"],
bottom: 100
});
// Available blur effects
var effects = [
Ti.UI.iOS.BLUR_EFFECT_STYLE_EXTRA_LIGHT,
Ti.UI.iOS.BLUR_EFFECT_STYLE_LIGHT,
Ti.UI.iOS.BLUR_EFFECT_STYLE_DARK,
Ti.UI.iOS.BLUR_EFFECT_STYLE_REGULAR,
Ti.UI.iOS.BLUR_EFFECT_STYLE_PROMINENT
];
tabs.addEventListener("click", function(e) {
blur.setEffect(effects[e.index]);
});
win.add(tabs);
win.add(img);
win.open();
The app will now log
[ERROR] The provided value for the Ti.UI.BlurView.effect property is not available in this iOS version.
if the provided effect is not available. PR (master): https://github.com/appcelerator/titanium_mobile/pull/8233 PR (6_0_X): https://github.com/appcelerator/titanium_mobile/pull/8232 PR (5_5_X): https://github.com/appcelerator/titanium_mobile/pull/8231 Please use the demo-code above.Verified as fixed, the following warning is returned when calling an iOS10 visual effect for Ti.UI.iOS.BlurView on < iOS10:
Tested On: iPhone 6S (10.0, 9.3.4, 8.2) Device Mac OSX El Capitan 10.11.6 Ti SDK: 5.5.0.v20160816120242 Appc Studio: 4.7.0.201607250649 Appc NPM: 4.2.7 App CLI: 6.0.0-25 Xcode 8.0 beta 6 (8S193k) Node v4.4.7 *Closing ticket.*