Ios 如何在Titanium中偏移标题控件
如何偏移钛合金中的标题控件 现在,我正在尝试在标题控件中的标签上放置一个left:-100属性,该属性在打开视图但它移回中心时有效 对于我如何实现这一转变,有什么建议吗 提前谢谢Ios 如何在Titanium中偏移标题控件,ios,controls,titanium,title,offset,Ios,Controls,Titanium,Title,Offset,如何偏移钛合金中的标题控件 现在,我正在尝试在标题控件中的标签上放置一个left:-100属性,该属性在打开视图但它移回中心时有效 对于我如何实现这一转变,有什么建议吗 提前谢谢 var txtSearch = Titanium.UI.createTextField({ hintText: 'Keyword to search for', height: 'auto', width: 220, left: -100, font: {fontSize: 12
var txtSearch = Titanium.UI.createTextField({
hintText: 'Keyword to search for',
height: 'auto',
width: 220,
left: -100,
font: {fontSize: 12},
enabled: true,
keyboardType:Titanium.UI.KEYBOARD_EMAIL,
returnKeyType:Titanium.UI.RETURNKEY_DEFAULT,
borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED,
autocapitalization: Titanium.UI.TEXT_AUTOCAPITALIZATION_NONE,
clearButtonMode: Titanium.UI.INPUT_BUTTONMODE_ONFOCUS
});
win.setTitleControl(txtSearch);
var btnSearch = Titanium.UI.createButton({
title: 'Search',
height: 'auto',
width: 'auto',
font: {fontSize: 13}
});
win.rightNavButton = btnSearch;
如果我点击搜索按钮,它会将我带到搜索结果页面,然后我点击后退按钮,文本框不会移动,看起来很好。。只有在页面首次加载时,才尝试将文本字段添加到视图中,然后将视图设置为标题控件:
var container = Ti.UI.createView({
width: 320
});
var txtSearch = Titanium.UI.createTextField({
hintText: 'Keyword to search for',
height: 'auto',
width: 220,
left: 0,
font: {fontSize: 12},
enabled: true,
keyboardType:Titanium.UI.KEYBOARD_EMAIL,
returnKeyType:Titanium.UI.RETURNKEY_DEFAULT,
borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED,
autocapitalization: Titanium.UI.TEXT_AUTOCAPITALIZATION_NONE,
clearButtonMode: Titanium.UI.INPUT_BUTTONMODE_ONFOCUS
});
container.add(txtSearch);
win.setTitleControl(container);
编辑@JosiahHester