ios - 钛 ScrollView
<p><p>我在 Titanium 中开发了一个应用程序。一个带有可 ScrollView 的代码。
它在 Android 中工作,但在 IOS 中不工作,并且不显示错误消息。
代码:</p>
<pre><code>exports.imagescroller = function(images, imgWidth, imgHeight){
var imageCollection = images;
var window = Ti.UI.createWindow({
backgroundColor:'transparent',
});
if(imgWidth == null) {
imgWidth = "100%";
}
if(imgHeight == null) {
imgHeight = "100%";
}
var scrollGallery = Ti.UI.createScrollableView({
layout:'horizontal',
showHorizontalScrollIndicator:true,
showVerticalScrollIndicator:true,
});
var viewCollection = [];
for (var i = 0; i < imageCollection.length; i++) {
var innerView = Ti.UI.createView({
layout:'horizontal',
});
var item = Ti.UI.createImageView({
width : imgWidth,
height: imgHeight,
imageID:i,
defaultImage: imageCollection
});
if (i < 3) {
item.image = imageCollection;
}
innerView.add(item);
viewCollection.push(innerView);
}
scrollGallery.addEventListener('scroll', function(e){
if (scrollGallery.currentPage < (imageCollection.length-1)) {
var nxt = scrollGallery.currentPage+1;
scrollGallery.views.children.image = imageCollection;
}
});
scrollGallery.views = viewCollection;
window.add(scrollGallery);
return window;
</code></pre>
<p>};</p>
<p>我在窗口中使用这个:</p>
<pre><code>var Scroller = require("imagescroller");
window = Scroller.imagescroller(allData['images']);
</code></pre>
<p>请帮帮我!
谢谢!</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>尝试使用更多跨平台的<code>scrollend</code>事件:</p>
<pre><code>scrollGallery.addEventListener('scrollend', function(e){
.......
});
</code></pre>
<p>还可以尝试为 ScrollableView 指定明确的宽度和高度,以排除这种情况:</p>
<pre><code>var scrollGallery = Ti.UI.createScrollableView({
layout:'horizontal',
showHorizontalScrollIndicator:true,
showVerticalScrollIndicator:true,
width : "100%"
height : "100%"
});
</code></pre></p>
<p style="font-size: 20px;">关于ios - 钛 ScrollView ,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/22195162/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/22195162/
</a>
</p>
页:
[1]