Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8968] iOS: titleControl property is positioning the image on top/left corner

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-05-07T11:20:01.000+0000
Affected Version/sRelease 2.1.0
Fix Version/sRelease 2.0.2, Release 2.1.0, Sprint 2012-10 API
ComponentsiOS
LabelsSupportTeam, api, module_window, qe-testadded, regression
ReporterFederico Casali
AssigneeVishal Duggal
Created2012-05-02T18:21:34.000+0000
Updated2012-07-09T10:43:06.000+0000

Description

Problem description

Using titleControl property to set the view to show in the navbar. View's backGroundImage is positioned on top/left corner of the windows navbar instead of in the center. Attaching screenshot

Code sample


Attached the background image used (ing_logo_header.png)

Titanium.UI.setBackgroundColor('#000');

// create tab group
var tabGroup = Titanium.UI.createTabGroup();
var  win = Titanium.UI.createWindow({
                    backgroundColor:'white',
                    title:'window',
                    barColor:'#ff7b01',
                    top:0,
                    navBarHidden:false
                });
                
    var tab1 = Titanium.UI.createTab({  
    icon:'KS_nav_views.png',
    title:'Tab 1',
    window:win
});           

 
var titleImage = Ti.UI.createView({
			width:94,
			height:24,
			// center
	backgroundImage:'/ing_logo_header.png',
});

win.titleControl = titleImage;
						
//win.open();
tabGroup.addTab(tab1);  
tabGroup.open();

Attachments

FileDateSize
ing_logo_header.png2012-05-02T18:21:34.000+00005812
Screen Shot 2012-05-02 at 4.27.33 PM.png2012-05-03T03:04:20.000+000096676

Comments

  1. Vishal Duggal 2012-05-04

    Broken due to the fix in TIMOB-8613.
  2. Vishal Duggal 2012-05-04

    Test Code. This includes the test case from TIMOB-8613
       Titanium.UI.setBackgroundColor('#000');
        
       // create tab group
       var tabGroup = Titanium.UI.createTabGroup();
       var titleImage = Ti.UI.createView({
                   width:94,
                   height:24,
           		backgroundImage:'/ing_logo_header.png',
       });
       
       var titleView = Ti.UI.createView({})
       var label = Ti.UI.createLabel({ text:'LONG TEXT WILL NOT FIT IN PORTRAIT', top:10 })
       titleView.add(label);
       var label2 = Ti.UI.createLabel({ text:'LONG2 TEXT WILL NOT FIT IN PORTRAIT', top:10 })
       
       var  win = Titanium.UI.createWindow({
                           backgroundColor:'white',
                           title:'window',
                           barColor:'#ff7b01',
                           top:0,
                           navBarHidden:false
                       });
       win.orientationModes = [Ti.UI.PORTRAIT,Ti.UI.LANDSCAPE_LEFT,Ti.UI.LANDSCAPE_RIGHT];             
       var tab1 = Titanium.UI.createTab({  
           icon:'KS_nav_views.png',
           title:'Tab 1',
           window:win
       });
       
       var btn1 = Ti.UI.createButton({
       	top:10,
       	height:30,
       	title:'Test Label'
       })
       
       btn1.addEventListener('click',function(){
       	win.titleControl = label2;
       })   
       
       var btn2 = Ti.UI.createButton({
       	top:45,
       	height:30,
       	title:'Test Image'
       })
       
       btn2.addEventListener('click',function(){
       	win.titleControl = titleImage;
       })   
       
       var btn3 = Ti.UI.createButton({
       	top:80,
       	height:30,
       	title:'Test View'
       })
       
       btn3.addEventListener('click',function(){
       	win.titleControl = titleView;
       })          
       
       win.add(btn1);
       win.add(btn2);
       win.add(btn3);                         
       //win.open();
       tabGroup.addTab(tab1);  
       tabGroup.open();
       
  3. Vishal Duggal 2012-05-04

    Adding merge label since TIMOB-8613 was merged into 2_0_X
  4. Natalie Huynh 2012-05-14

    Tested with 2.0.2.v20120510223154 on iPhone 4 5.0.1

JSON Source