swift - Using setBackgroundImageNamed with iteration -


in watchkit, there way assign background images named groups using iterative process such in example below? (groupname + i) must replaced, though i'm not sure precisely.

import watchkit import foundation  class interfacecontroller: wkinterfacecontroller {      @iboutlet weak var groupname0: wkinterfacegroup!     @iboutlet weak var groupname1: wkinterfacegroup!     @iboutlet weak var groupname2: wkinterfacegroup!      @ibaction func buttonpressed() {         var = 0, < 3, i++ {             (groupname + i).setbackgroundimagenamed("image" + string(i))         }     } } 

just add wkinterfacegroup instances array , iterate on that. variables aren't strings, can't concatenate variable name. also, shouldn't name variables xxxname: references object instances, not strings.


Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -