ios - how to switch visibility GONE and VISIBLE swift -


i want switch between 2 switch gone , visible doing on android, not know in swift try code in gone label

// set width constraint 0   let widthconstraint = nslayoutconstraint(item:  self.labelshortdescription, attribute: nslayoutattribute.width, relatedby: nslayoutrelation.equal, toitem: nil, attribute: nslayoutattribute.notanattribute, multiplier: 1, constant: 0)   self.labelshortdescription.addconstraint(widthconstraint)  // set height constraint 0    let heightconstraint = nslayoutconstraint(item:  self.labelshortdescription, attribute: nslayoutattribute.height, relatedby: nslayoutrelation.equal, toitem: nil, attribute: nslayoutattribute.notanattribute, multiplier: 1, constant: 0)    self.labelshortdescription.addconstraint(heightconstraint) 

invisible:

this view invisible, still takes space layout purposes.

to achieve in ios:

yourview.alpha = 0 

gone:

this view invisible, , doesn't take space layout purposes.

to achieve in ios:

yourview.removefromsuperview() 

Comments

Popular posts from this blog

sql - Time in datatime field -

javascript - How to split the success output from an Ajax post? -

java - sharing object across different classes -