Ios 文本区域滚动不工作[钛]

Ios 文本区域滚动不工作[钛],ios,image,uiscrollview,textarea,titanium,Ios,Image,Uiscrollview,Textarea,Titanium,我正在创建一个iOS应用程序,其中用户单击一个图像,字母“A”连接到一个字符串变量 现在,我有一个文本区域,其值为变量字符串。每次将新字母连接到变量字符串时,文本区域值都会更新 问题是,当文本区域的宽度;之后添加的字母不可见。当字符串长度超过文本区域的宽度时,如何使最后输入的字符始终可见 需要解决这个问题 代码: var image = Ti.UI.createImageView({ backgroundColor:'red', width: 200, height:100 }); wi

我正在创建一个iOS应用程序,其中用户单击一个图像,字母“A”连接到一个字符串变量

现在,我有一个文本区域,其值为变量字符串。每次将新字母连接到变量字符串时,文本区域值都会更新

问题是,当文本区域的宽度;之后添加的字母不可见。当字符串长度超过文本区域的宽度时,如何使最后输入的字符始终可见

需要解决这个问题

代码:

var image = Ti.UI.createImageView({
 backgroundColor:'red',
 width: 200,
 height:100
});

win.add(image);

var scroll = Ti.UI.createScrollView({
 top:40,
 left:230,
 width:290,
 height:50,
 borderRadius:10,
 backgroundColor:'transparent',
 scrollType:'horizontal',
 scrollingEnabled : 'true',
 showVerticalScrollIndicator:true,
 showHorizontalScrollIndicator:true,
 });

win.add(scroll);



var textType = Ti.UI.createTextArea({
 backgroundColor:'#E6E6E6',
 borderColor:'blue',
 borderRadius:10,
 top:0,
 left:-70,
 width:390,
 height:50,
 font:{fontSize:26, fontFamily:customFont},
 editable:true,
 enabled:false,
 textAlign:'right',
 scrollable:true,
 horizontalScroll : true,
 scrollType:'horizontal'
 });

scroll.add(textType);

image.addEventListener('click, function(e){
   string = string + "A";
   textType.setValue(string);
}

您可以尝试设置
horizontalWrap:true,这将使文本显示在下一行而不是屏幕外

或者,如果
textType.width>scroll.width
,则设置
scroll.contentOffset.x=textType.width-scroll.width
。我不确定Tianium在语法上的细微差别,但在常规的Objective-C/iOS程序中就是这样做的