iOS controls hide and gone like android

后端 未结 4 1563
没有蜡笔的小新
没有蜡笔的小新 2021-01-04 09:05

I have used storyboard with autolayout for my UI design. Basically in android there are three different properties will be there like Visible, Invis

4条回答
  •  借酒劲吻你
    2021-01-04 09:44

    if your view for example

    @property (weak, nonatomic) IBOutlet SearchBarView *searchBar;
    

    already has a constraint with it. Add a new IBLayout by dragging your constraint to the .h file.ex:

    @property (weak, nonatomic) IBOutlet NSLayoutConstraint *constraintSearBarHeight;
    

    and do this in where ever you like

    self.constraintSearBarHeight.constant = 0;
    

    if your view don't have a constraint yet. I found this answer helpful. Just do below

    [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.searchBar attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:0]];
    

提交回复
热议问题