2013-08-03 3 views
0

사용자가 이미지를 클릭하고 문자 "A"가 문자열 변수에 연결되는 iOS 앱을 만듭니다.TextArea 스크롤링이 작동하지 않습니다. [Titanium]

이제 가변 문자열 값이있는 텍스트 영역이 있습니다. 텍스트 영역 값은 새 문자가 변수 문자열에 연결될 때마다 업데이트됩니다.

문제는 텍스트 영역의 너비가 이후에 추가 된 글자는 볼 수 없습니다. 문자열 길이가 텍스트 영역의 너비를 초과하면 입력 된 마지막 문자를 항상 볼 수있게하려면 어떻게해야합니까?

해결 방법이 필요합니다.

코드 : 당신은 텍스트가 꺼져 화면보다는 다음 행에 표시 할 것 horizontalWrap:true;를 설정을 시도 할 수

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); 
} 

답변

0

.

또는 인 경우 scroll.contentOffset.x = textType.width - scroll.width을 설정하십시오. Titanium의 문법적 뉘앙스에 대해서는 잘 모르겠지만, 일반적인 Objective-C/iOS 프로그램에서이 방법을 사용하는 방법입니다.

관련 문제