[TIMOB-25538] iOS: Original back button in iOS navigation bar shows briefly after replacing it with a custom one.
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | None |
| Status | Resolved |
| Resolution | Not Our Bug |
| Resolution Date | 2017-11-20T11:33:03.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | n/a |
| Labels | n/a |
| Reporter | Jebun Naher |
| Assignee | Hans Knöchel |
| Created | 2017-11-20T11:08:23.000+0000 |
| Updated | 2017-11-29T23:41:31.000+0000 |
Description
*Issue Description:*
When I add a custom back button using leftNavButton, the original iOS back button appears briefly before the custom one appears. I'm experiencing this behaviour using latest ti SDK 6.3.0.GA.
*Steps to reproduce:*
- Add a custom image in project directory and rename it to backbtn.png
- Then run the sample code below
- A red window should appear, click *Open blue window* button
At this point, observe that the default iOS back button appears briefly before the custom one.
*Expected:*
The default iOS back button should not appear.
*Actual:*
The default iOS back button appears briefly before the custom back button appears.
*Test Code:*
*app.js*
var back_btn = Ti.UI.createView({
backgroundImage: 'backbtn.png',
width : 50,
height : 20,
left : '5'
});
var win2 = Titanium.UI.createWindow({
backgroundColor : 'red',
title : 'Red Window',
});
var win1 = Titanium.UI.iOS.createNavigationWindow({
window : win2
});
var win3 = Titanium.UI.createWindow({
backgroundColor : 'blue',
title : 'Blue Window',
leftNavButton : back_btn
});
var button = Titanium.UI.createButton({
title : 'Open Blue Window'
});
button.addEventListener('click', function() {
win1.openWindow(win3);
});
win2.add(button);
back_btn.addEventListener('click', function() {
win3.close();
});
win1.open();
Attachments
| File | Date | Size |
|---|---|---|
| leftArrow@2x.png | 2017-11-20T11:33:18.000+0000 | 1821 |
You should use a
Ti.UI.Buttoninstance for left/right nav butttons to confirm to the iOS archtecture. I changed your code a bit and it now works perfectly (see the "leftArrow.png" attached as well):var back_btn = Ti.UI.createButton({ image: 'leftArrow.png', }); var win2 = Titanium.UI.createWindow({ backgroundColor : 'red', title : 'Red Window', }); var win1 = Titanium.UI.iOS.createNavigationWindow({ window : win2 }); var win3 = Titanium.UI.createWindow({ backgroundColor : 'blue', title : 'Blue Window', leftNavButton : back_btn }); var button = Titanium.UI.createButton({ title : 'Open Blue Window' }); button.addEventListener('click', function() { win1.openWindow(win3); }); win2.add(button); back_btn.addEventListener('click', function() { win3.close(); }); win1.open();I am seeing this with Appcelerator 6.3.0 and Titanium SDK 6.2.2 when navigating within an iOS TabGroup, even when I use Ti.UI.Button.