Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17593] iOS: Labels not layed out correctly on toImage()

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-11-04T03:57:51.000+0000
Affected Version/sRelease 3.3.0
Fix Version/sRelease 4.0.0
ComponentsiOS
LabelsTCSupport, labels, regression, rendering, toImage
ReporterTobias
AssigneeVishal Duggal
Created2014-08-14T07:45:32.000+0000
Updated2015-01-16T01:00:51.000+0000

Description

Problem Description

In 3.3.0.GA all labels disappears when I do toImage() on their container view. This worked perfectly fine in all versions before 3.3.0.GA (try 3.2.3.GA for instance). This toImage()-approach is very useful to build images of the gui instead of having components (such as labels) rendered all the time. It makes the UI much snappier/performant and I use it alot. This is a complete stopper for me.

Sample Code

Titanium.UI.setBackgroundColor('#000');
var view= require('FirstView');
var win1 = Titanium.UI.createWindow({  
    title:'Tab 1',
    backgroundColor:'#fff'
});
win1.add(view());
win1.open();


function FirstView() {
 
    var buildView = Ti.UI.createView({
        backgroundColor:'red',
        width:100,
        height:100
    });
 
    buildView.add(Ti.UI.createLabel({
        backgroundColor:'yellow',
        color:'#000000',
        text:'ABC',
    }));
     
    var container = Ti.UI.createView({
        width:100,
        height:100,
        backgroundImage: buildView.toImage()
    });
 
    return container;
}
module.exports = FirstView;

Steps to reproduce

- Create a new Project. - Copy the "app.js" code to the project "app.js" file. - Create a new file named "FirstView" in Projects Resource directory. - Copy the "FirstView.js" code to the project "FirstView.js" file. - Run the Project.

Actual results

OBSERVED PROBLEM In SDK version 3.2.3.GA the label is shown where in SDK version 3.3.0.GA the label despaired. view.toImage() is not working in New SDK 3.3.0.GA

Attachments

FileDateSize
3.2.3.GA.png2014-08-14T07:45:32.000+000020812
3.3.0.GA.png2014-08-14T07:45:33.000+000019478

Comments

  1. stefano di luca 2014-09-19

    Yes I'm experiencing this problem too, toImage() doesn't render labels from SDK 3.3.0, the bug is still present in the new SDK 3.4.0
  2. Carlos Fleck 2014-10-22

    This error also occurs to me, as it occurred from version 3.3.0, and it is only to be fixed in version 3.5 which is scheduled for 19 / Mar / 2015. Would not be possible to place with the release of 3.4.2?
  3. Vishal Duggal 2014-11-03

    Pull pending against master https://github.com/appcelerator/titanium_mobile/pull/6302
  4. Chee Kiat Ng 2014-11-04

    PR merged.
  5. Ewan Harris 2015-01-16

    Verified fix on: Mac OSX 10.10.1 Appcelerator Studio, build: 3.4.1.201410281743 Titanium SDK build: 3.6.0.v20150115142105 Titanium CLI, build: 3.4.1 Alloy: 1.5.1 Xcode 6.1.1 iPhone 6 Plus (8.1.1), iPad Air 2 (8.2b4) Using the attached code built to both devices, the labels are laid out correctly each time, added more views and the labels stayed in the correct position. Closing ticket.

JSON Source