Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2834] BarImage breaks Title text in navigation group

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2012-02-14T23:36:44.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.7.2, Sprint 2012-04, Release 2.0.0, Release 1.8.2
ComponentsiOS
Labelsbarimage, defect, ios, iphone, module_navgroup, parity, qe-testadded, reported-1.5.1, reported-1.6.0, title
Reportereddiemonge
AssigneeBlain Hamon
Created2011-04-15T03:30:38.000+0000
Updated2012-03-04T22:20:19.000+0000

Description

If you have a barImage in a NavigationGroup, it deletes the title Text on child windows, only after one child window is called. The barImage works correctly on the parent and on the first child window called but not subsequent child images

Code can be found at http://pastie.org/1461234">http://pastie.org/1461234
barTop.png needs to be placed in the Resources directory

Attachments

FileDateSize
bartop.png2011-04-15T03:30:38.000+000017494

Comments

  1. kevinwhinnery 2011-04-15

    Testing this example in 1.6.0 (http://github.com/appcelerator/titanium_mobile/commit/1ef086793961881e31b5de3e0c99a20923d0296b">1/17/11), the first label reliably opens the second window with the correct bar image. The second label opens a window, but the title and content are missing missing. From here, clicking either label will result in a missing title. As coded, this example would seem to be adding/opening windows correctly.

  2. eddiemonge 2011-04-15

    Some additional notes I have discovered:

    If you set the barImage on the parent window when the child opens and set the child to null, then reset the child when it closes, it works right.

       second.addEventListener('open', function() {

       first.barImage = 'barTop.png';
       second.barImage = null;
       
       
       
       
    }); second.addEventListener('close', function() { second.barImage = 'barTop.png'; });
    third.addEventListener('open', function() {
       first.barImage = 'barTop.png';
       third.barImage = null;
       
       
       
       
    }); third.addEventListener('close', function() { third.barImage = 'barTop.png'; });
  3. eddiemonge 2011-04-15

    It almost seems like the barImage is created as a view and is then placed over the top bar view. The back button will still work even though you cant see it.

  4. Pedro Enrique 2011-04-15

    I am confirming that this bug still exist. Basically, when a navigation window is closed, the child window's barImage will be on top of the parent's navigation bar.

    The example provided above shows the bug. Please refer to Helpdesk ticket http://developer.appcelerator.com/helpdesk/view/75181">75181

  5. Rodrigo K Nascimetno 2011-04-15

    Open /Library/Application Support/Titanium/mobilesdk/osx/1.6.1/iphone/Classes
    Find line 778 with this comment: //[barImageView removeFromSuperview];
    Remove slashes comment, example:

    -(void)_tabBeforeBlur { // Changed by rodrigoknascimento@gmail.com at 13 april 2011 - 10:35 (GMT -3) Brasil

       [barImageView removeFromSuperview];
       [super _tabBeforeBlur];
       

    }

    Delete "build" folder into your project and run simulator trought Titanium to recreate it.

    Have fun.

  6. Rafael Kellermann Streit 2011-04-15

    Thanks Rodrigo, that's very nice.

  7. Blain Hamon 2011-06-23

    The code in the pastie is below (In case pastie expires the link)
       //Here's the first window...
       var first = Ti.UI.createWindow({
         backgroundColor:"#fff",
         title:"My App",
         barImage: 'barTop.png'
       });
       var label = Ti.UI.createLabel({ text: "poke me to open the next window",top:0,height:30 });
       first.add(label);
       
       var label2 = Ti.UI.createLabel({ text: "poke me to open the next window",top:40,height:30 });
       first.add(label2);
       
       //Here's the nav group that will hold them both...
       var navGroup = Ti.UI.iPhone.createNavigationGroup({
         window:first
       });
       
       //Here's a window we want to push onto the stack...
       var second = Ti.UI.createWindow({
         background:"#fff",
         title:"Child Window",
         barImage: 'barTop.png'
       });
       second.add(Ti.UI.createLabel({text:"Here's the child", color: '#000000'}));
       
       //Here's a window we want to push onto the stack...
       var third = Ti.UI.createWindow({
         background:"#fff",
         title:"Second Child Window",
         barImage: 'barTop.png'
       });
       second.add(Ti.UI.createLabel({text:"Here's the child", color: '#000000'}));
       
       //When the label on the first window receives a touch, open the second
       label.addEventListener("click", function(e) {
         navGroup.open(second);
       });
       
       //When the label on the first window receives a touch, open the second
       label2.addEventListener("click", function(e) {
         navGroup.open(third);
       });
       
       //This is the main window of the application
       var main = Ti.UI.createWindow();
       main.add(navGroup);
       main.open();
       
  8. Alan Vaghti 2011-07-07

    Passed as expected on iPhone running iOS 4.2.8 and iOS 3.1.2 as
  9. Alan Vaghti 2011-07-07

    * also passed on iPad w/ iOS 4.3
  10. Alan Vaghti 2011-08-29

    Fix seen in SDK 1.8.0.v20110817105307
  11. Felipe Cypriano 2012-02-13

    I'm using Titanium Mobile 1.8.1 building with iOS SDK 5.0 and this bug still exists. IMO it should be reopened.
  12. Thomas Huelbert 2012-02-13

    Felipe, can you please provide code that reproduces your findings? The code attached to this bug does not show any issues. Thanks!
  13. Felipe Cypriano 2012-02-14

    Hi Thomas, I just realize that the code is a little different from the original. This is the reproducible code:
        //Here's the first window...
        var first = Ti.UI.createWindow({
          backgroundColor:"#fff",
          title:"My App",
          barImage: 'barTop.png'
        });
        var label = Ti.UI.createLabel({ text: "poke me to open the next window",top:0,height:30 });
        first.add(label);
        
        var label2 = Ti.UI.createLabel({ text: "poke me to open the next window",top:40,height:30 });
        
        //Here's the nav group that will hold them both...
        var navGroup = Ti.UI.iPhone.createNavigationGroup({
          window:first
        });
        
        //Here's a window we want to push onto the stack...
        var second = Ti.UI.createWindow({
          backgroundColor:"#fff",
          title:"Child Window",
          barImage: 'barTop.png'
        });
        second.add(label2);
        
        //Here's a window we want to push onto the stack...
        var third = Ti.UI.createWindow({
          backgroundColor:"#fff",
          title:"I'm a hidden title",
          barImage: 'barTop.png'
        });
        third.add(Ti.UI.createLabel({text:"Here's the child with hidden title", color: '#000000'}));
        
        //When the label on the first window receives a touch, open the second
        label.addEventListener("click", function(e) {
          navGroup.open(second);
        });
        
        //When the label on the first window receives a touch, open the second
        label2.addEventListener("click", function(e) {
          navGroup.open(third);
        });
        
        //This is the main window of the application
        var main = Ti.UI.createWindow();
        main.add(navGroup);
        main.open();
        
    The problem occur on the third window in the navigation group.
  14. Devang Gandhi 2012-02-14

    Yea the bug Exists. Here is the sample code.
        function newWin()
        {
        	var newWin = Ti.UI.createWindow({
        		backgroundColor:'white',
        		barImage: 'images/header-backer.png',
        		title: 'New Window'
        	});
        
        	var newBtn = Ti.UI.createButton({
        		title: 'new win',
        		top: 20,
        		left: 20,
        		width: 200,
        		height: 20
        	});
        
        	newBtn.addEventListener('click', function() {
        		navGroup.open(openWin());
        	});
        	
        	var newBack = Ti.UI.createButton({
        		title: 'back',
        		top: 0,
        		left: 0,
        		width: 100,
        		height: 15
        	});
        	
        	newBack.addEventListener('click', function() {
        		closeWin(newWin);
        	});
        	
        	newWin.leftNavButton = newBack;
        	
        	newWin.add(newBtn);
        	
        	return newWin;
        }
        
        function openWin()
        {
        	return newWin();
        }
        
        function closeWin(newWin)
        {
        	navGroup.close(newWin);
        }
        
        var win = Ti.UI.createWindow({
        	backgroundColor:'white',
        	barImage: '/header-backer.png',
        	title: 'Main Window'
        });
        
        var btn = Ti.UI.createButton({
        	title: 'new win',
        	top: 20,
        	left: 20,
        	width: 200,
        	height: 20
        });
        
        btn.addEventListener('click', function() {
        	var winToOpen = newWin();
        	navGroup.open(winToOpen);
        });
        
        win.add(btn);
        
        var navGroup = Ti.UI.iPhone.createNavigationGroup({
        	window : win
        });
        
        var containerWindow = Ti.UI.createWindow();
        containerWindow.add(navGroup);
        containerWindow.open();
        
        
  15. Neeraj Gupta 2012-02-14

    Reopening this issue based on last 2 comments.
  16. Michael Pettiford 2012-02-14

    Felipe & Devang Thanks for providing updated sample test cases. I verified that this is indeed an issue in 1.8.1 I also tested against the latest master branch (AOTW 1.9.0.v20120213174634) from the CI build page http://builds.appcelerator.com.s3.amazonaws.com/index.html and this issue does not occur there.

JSON Source