Skip to content

Instantly share code, notes, and snippets.

@hvgotcodes
Created May 9, 2012 01:17
Show Gist options
  • Save hvgotcodes/2640935 to your computer and use it in GitHub Desktop.
Save hvgotcodes/2640935 to your computer and use it in GitHub Desktop.
for color, i in ['yellow', 'red', 'white', 'blue', 'red']
@container.add view = Ti.UI.createView
backgroundColor: color
top: 2
left: 2 + 42 * i
height: 20,
width: 40
view.addEventListener 'click', do (color) ->
(color) ->
Ti.API.info "color #{ color }"
@rf
Copy link

rf commented May 9, 2012

_.each ['yellow', 'red', 'white', 'blue', 'red'], (color) =>
   @container.add view = Ti.UI.createView backgroundColor: color
   view.addEventListener 'click', -> Ti.API.info "color #{color}"

@hvgotcodes
Copy link
Author

for color, i in ['yellow', 'red', 'white', 'blue', 'red']
@container.add view = Ti.UI.createView
backgroundColor: color
top: 2
left: 2 + 42 * i
height: 20,
width: 40

  view.addEventListener 'click', do (color) ->
    (color) ->
      Ti.API.info "color #{ color }"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment