ฉันต้องการเพิ่ม webview ซึ่งความสูงจะเป็นตามเนื้อหา ฉันทำให้มันทำงานได้อย่างราบรื่นบน Android แต่บน iOS ยิ่งข้อความยาว พื้นที่ด้านล่างข้อความก็จะยิ่งยาวขึ้น
นี่คือรหัสของฉัน:
var window = Ti.UI.createWindow();
var scrollView = Ti.UI.createScrollView({
layout: 'vertical',
height: Ti.UI.SIZE
});
var view1 = Ti.UI.createView({
height: 200,
backgroundColor: 'red'
});
var webview = Ti.UI.createWebView({
height: Ti.UI.SIZE,
html: '<html><head><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2"></head><body style="margin:0; background-color: blue">Some page some text2</body></html>'
});
var view2 = Ti.UI.createView({
height: 200,
backgroundColor: 'green'
});
scrollView.add(view1);
scrollView.add(webview);
scrollView.add(view2);
window.add(scrollView);
window.open();
ขอบคุณล่วงหน้า.