alibaba / wax

Wax is a framework that lets you write native iPhone apps in Lua.
http://github.com/probablycorey/wax
MIT License
1.84k stars 280 forks source link

attempt to call method 'selected' (a nil value) #44

Closed ldu1101 closed 8 years ago

ldu1101 commented 8 years ago

I define a button,and set button‘s property selected is false,as a result, it is crashed,How can I do ? below is code:

function setupButton(self) local bt = UIButton:initWithFrame(CGRect(200,100,100,30)) self:view():addSubview(bt) bt:setSelected(false) print(bt:selected())-- causes Runtime error: attempt to call method 'selected' (a nil value) end

intheway commented 8 years ago

it means there is no method 'selected' in UIButton. see the definition: @property(nonatomic,getter=isSelected) BOOL selected; so, you should use print(bt:isSelected())