[TIMOB-23666] iOS: Button setting remote backgroundImage doesn't appear to work
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | High |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2017-02-02T21:55:50.000+0000 |
| Affected Version/s | Release 5.4.0 |
| Fix Version/s | Release 6.1.0 |
| Components | iOS |
| Labels | imageview, ios, qe-6.0.0, remoteurl |
| Reporter | Angel Petkov |
| Assignee | Vijay Singh |
| Created | 2016-07-20T23:54:32.000+0000 |
| Updated | 2017-02-03T17:56:01.000+0000 |
Description
Setting the backgroundImage property with a remote image doesn't appear to be working.
*Demo Code:*
var win = Ti.UI.createWindow({
backgroundColor: 'white'
});
var url = Ti.UI.createButton({
title: "URL Image",
top: 100,
height: 100,
backgroundImage: "http://www.devnetwork.com/wp-content/uploads/2015/07/Appcelerator-logo.png",
});
var local = Ti.UI.createButton({
title: "Local Image",
bottom: 100,
height: 100,
backgroundImage: "images/appcelerator_small.png",
});
setTimeout(function() {
url.setBackgroundImage("https://upload.wikimedia.org/wikipedia/commons/a/ab/Logo_TV_2015.png");
local.setBackgroundImage("images/atlanta.jpg");
},2000);
win.add(local)
win.add(url);
win.open();
*Test Case:*
Run the app and take a picture.
*Expected Result:*
The two buttons should all have a backgroundImage one containing a local image, another containing an image from a URL.
*Actual Results*
Passing in a url or local path doesn't work with setBackgroundImage.
PR:https://github.com/appcelerator/titanium_mobile/pull/8149
Verified as fixed, using a remote resource to set
backgroundImage&setBackgroundImagefor a Button element now works correctly. Tested On: iPhone 6 Plus 10.0.1 Device & Simulator iPhone 5S 9.3.5 Device Mac OSX El Capitan 10.11.6 Ti SDK: 6.0.0.v20160922165510 Appc Studio: 4.8.0.201609101003 Appc NPM: 4.2.8-6 App CLI: 6.0.0-51 Xcode 8.0 Node v4.4.7 *Closing ticket.*Reopening this original issue, since this caused multiple other issues in 6.0.x. PR (master): https://github.com/appcelerator/titanium_mobile/pull/8644 PR (6_0_X): https://github.com/appcelerator/titanium_mobile/pull/8645
PR (master) : https://github.com/appcelerator/titanium_mobile/pull/8691 This change will affect background image setting for TIUIiOSToolbar, TIUISearchbar, TIUITabGroup, TiUITextField and TIUIiOSStepper and TIUIButton's all state(selected , highlighted etc). If images are not cached, it will download image from remote .
var win = Ti.UI.createWindow(); var container = Ti.UI.createView({ backgroundColor: 'white', top:100, layout:'vertical', width:450 }); var button = Ti.UI.createButton({ top:0, backgroundTopCap:10, backgroundLeftCap:10, width:450, height:100, backgroundImage:'images/button_background.png', }); var send = Titanium.UI.createButton({ title: 'Send', width: 225, style: Titanium.UI.iOS.SystemButtonStyle.DONE, }); var camera = Titanium.UI.createButton({ width: 225, systemButton: Titanium.UI.iOS.SystemButton.CAMERA, }); var toolBar = Ti.UI.iOS.createToolbar({ items:[send,camera], top:50, backgroundTopCap:10, backgroundLeftCap:10, width:450, height:100, backgroundImage:'images/button_background.png', }); var view = Ti.UI.createView({ top:50, backgroundImage:'images/button_background.png', backgroundTopCap:10, backgroundLeftCap:10, width:450, height:100 }); setTimeout(function() { toolBar.setBackgroundImage("http://www.devnetwork.com/wp-content/uploads/2015/07/Appcelerator-logo.png"); //view.setBackgroundImage("http://www.devnetwork.com/wp-content/uploads/2015/07/Appcelerator-logo.png"); button.setBackgroundImage("https://upload.wikimedia.org/wikipedia/commons/a/ab/Logo_TV_2015.png"); },5000); container.add(button); container.add(view); container.add(toolBar); win.add(container); win.open();Can verify that Toolbar background, View background and Button background all changed after to 5 seconds to remote images. This was tested with; iPhone 7 and Simulator (10.2) MacOS 10.11.6 (15G31) Studio 4.8.1.201612050850 Ti SDK 6.1.0.v20170202120400 Appc NPM 4.2.8 Appc CLI 6.2.0-12 Ti CLI 5.0.11 Alloy 1.9.6 Arrow 1.10.2 Xcode 8.2 (8C38) Node v4.6.0 Java 1.7.0_80