Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23666] iOS: Button setting remote backgroundImage doesn't appear to work

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2017-02-02T21:55:50.000+0000
Affected Version/sRelease 5.4.0
Fix Version/sRelease 6.1.0
ComponentsiOS
Labelsimageview, ios, qe-6.0.0, remoteurl
ReporterAngel Petkov
AssigneeVijay Singh
Created2016-07-20T23:54:32.000+0000
Updated2017-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.

Comments

  1. Angel Petkov 2016-07-20

    PR:https://github.com/appcelerator/titanium_mobile/pull/8149
  2. Harry Bryant 2016-09-23

    Verified as fixed, using a remote resource to set backgroundImage & setBackgroundImage for 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.*
  3. Hans Knöchel 2016-11-30

    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
  4. Vijay Singh 2016-12-15

    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();
       
  5. Lee Morris 2017-02-03

    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

JSON Source