ios - Swift: Why isn't my -1 button working properly? -


i have +1 button , -1 button , label starts @ 0. +1 button working great, reason, -1 button isn't working. can help?

var sales = 0  @iboutlet weak var numberofsaleslabel: uilabel! @iboutlet weak var minusonesaleoutlet: uibutton!  @ibaction func plusonesale(sender: anyobject) {     sales += 1     numberofsaleslabel.text = "\(sales)"     if sales >= 1 {         minusonesaleoutlet.hidden = false        } }  override func viewdidload() { }  @ibaction func minusonesale(sender: anyobject) {     sales -= 1     numberofsaleslabel.text = "\(sales)"      if sales == 0 {         minusonesaleoutlet.hidden = true     } } 

anybody got ideas why minus button isn't working? i'm thinking might have me calling outlet , action, i'm not sure. thanks!

p.s.-i'm not sure if normal.

enter image description here

using connections inspector you'll need make sure connections correct.

if @ point delete @ibaction code, create connection, old 1 still remain until remove connection inspector.

each of buttons should connected single @ibaction (touchupinside)

below connections inspector looks like. image 1 of own projects, , shows connected delegate. yours bit different.

if else fails, remove connections on view (click x) , link them again ctrl dragging button, code viewer right on top of @ibaction. easier start again.

enter image description here


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -