基本上,我需要从五个图像创建图层。有没有办法通过for
循环来做到这一点,而不是手动创建图层?以下代码是我的尝试,但我不确定如何从这里调试。
tabs_strings = ["nearby", "adopted", "my_cats", "settings", "bruce"]
for tab in [0..tabs_strings]
tab = new Layer
x:0, y:0, width:640, height:1136, image:"images/#{tab}.jpg"
# nearby = new Layer
# x:0, y:0, width:640, height:1136, image:"images/nearby.jpg"
# adopted = new Layer
# x:0, y:0, width:640, height:1136, image:"images/adopted.jpg", opacity: 0
# my_cats = new Layer
# x:0, y:0, width:640, height:1136, image:"images/my_cats.jpg", opacity: 0
# settings = new Layer
# x:0, y:0, width:640, height:1136, image:"images/settings.jpg", opacity: 0
# bruce = new Layer
# x:0, y:0, width:640, height:1136, image:"images/bruce.jpg", opacity: 0