ios - Auto layout removing from superview doesn't update -


i'm trying make uilabel grow removing constraints via removefromsuperview. text field 1 removed. still doesn't let uilabel grow in width. have attached sample code here reference. on story board.

here viewdidload method:

  self.label1.text = @"label 1";   self.label2.text = @"label 2";   self.textfield1.text = @"text field 1";   self.textfield2.text = @"text field 2";   [self.textfield1 removefromsuperview];  

i don't want have iboutlet of constraints , update on code. i'm trying on storyboard once.

i think label 2 depending on position textfield 1, , want label 2 grow occupy space of textfield 1 when remove textfield 1. however, since label 2 (say, 20 pixels right of textfield 1), when remove textfield 1, constraint removed (it invalid textfield 1 no longer exists!) , default 1 generated relative superview.

there simple solution rather imperfect - instead of removing superview set width of textfield 1 0. see change in label 2's position.

for more control however, think still have iboutlet constraint.


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -