objective c - iOS constraints not updating as expected -


i have superview circle view , holderview contains 3 labels subview , centred superview seen in image enter image description here

i have added constraints 3 labels respect holderview , added constraints holderview respect superview

nsdictionary *viewsdictionary = nsdictionaryofvariablebindings(titlelabel); nsarray *constraints = [nslayoutconstraint constraintswithvisualformat:@"|-[titlelabel]-|"                                         options:0                                         metrics:nil                                           views:viewsdictionary];  [holderview addconstraints:constraints];   viewsdictionary = nsdictionaryofvariablebindings(setlabel); constraints = [nslayoutconstraint constraintswithvisualformat:@"|-[setlabel]-|"                                         options: 0                                         metrics:nil                                           views:viewsdictionary];  [holderview addconstraints:constraints];   viewsdictionary = nsdictionaryofvariablebindings(replabel); constraints = [nslayoutconstraint constraintswithvisualformat:@"|-[replabel]-|"                                         options:0                                         metrics:nil                                           views:viewsdictionary];  [holderview addconstraints:constraints];  viewsdictionary = nsdictionaryofvariablebindings(titlelabel, setlabel, replabel); constraints = [nslayoutconstraint constraintswithvisualformat:@"v:|-[titlelabel]-0-[setlabel]-0-[replabel]-|"                                         options:0                                         metrics:nil                                           views:viewsdictionary];  [holderview addconstraints:constraints];   nsdictionary *viewsdictionary = nsdictionaryofvariablebindings(_labelview);     nsarray *constraints =[nslayoutconstraint constraintswithvisualformat:@"|-[_labelview]-|"                                                                   options:0                                                                   metrics:nil                                                                     views:viewsdictionary];     [self addconstraints:constraints]; 

there feature in app circle shrinks. want holderview , subivews shrink dynamically. adding constraints works holderview subviews misaligned.

enter image description here enter image description here

to shrink update frame size of holderview superview frame changes.

can point out mistakes , guide me proper solution ?

using auto layout , changing frame property messes things.

create oultest constraints want change or animate

__weak iboutlet uiview *settingsview; __weak iboutlet nslayoutconstraint *settingsbottomconstraint; __weak iboutlet nslayoutconstraint *settingsviewheightconstraint; 

update constrains(never frame!)

settingsbottomconstraint.constant = - settingsviewheightconstraint.constant; [settingsview setneedsupdateconstraints]; [settingsview layoutifneeded]; issettingshidden = yes; 

recently have worked animation of views autolayout , can find answer here auto layout constraint change not animate


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -