Programmatically Add CenterX/CenterY Constraints

前端 未结 7 752

I have a UITableViewController that doesn\'t display any sections if there is nothing to show. I\'ve added a label to indicate to the user that there is nothing to display w

7条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-29 18:52

    The ObjectiveC equivalent is:

        myView.translatesAutoresizingMaskIntoConstraints = NO;
    
        [[myView.centerXAnchor constraintEqualToAnchor:self.view.centerXAnchor] setActive:YES];
    
        [[myView.centerYAnchor constraintEqualToAnchor:self.view.centerYAnchor] setActive:YES];
    

提交回复
热议问题