ios - Buttons & Switches -
this question has answer here:
i have switch thats prints "its on" when on , "its off" when off. since want have more switches in future, decided wanted have button acts general, therefore when press button, switch sets on, problem is, doesn't print "its on".
essentially if directly click switch, supposed to; if change switch's status through button, doesn't, switches on, , doesn't print anything.
button code:
@ibaction func button(sender: uibutton) { self.sswitch.seton(true, animated: false) }
switch code:
@ibaction func switch(sender: uiswitch) { if self.sswitch.on { print("its on") } else { print("its off") }
this expected situation.
if user triggers change control send action messages each of targets. if change made directly in code no action messages sent.
so, if change state in code it's send (appropriate) action messages if makes sense so.
Comments
Post a Comment