Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios autolayout 我想把TextField的位置设置在将被隐藏的TextField的正上方?_Ios Autolayout - Fatal编程技术网

Ios autolayout 我想把TextField的位置设置在将被隐藏的TextField的正上方?

Ios autolayout 我想把TextField的位置设置在将被隐藏的TextField的正上方?,ios-autolayout,Ios Autolayout,这里我有三个文本字段,它们都被设置好了,现在我想要第三个文本字段的位置来代替第二个,一旦我隐藏了第二个文本字段,第三个文本字段的位置应该移到上面 这里,这个应该是这样的 请注意:我是自动布局的初学者,因此如果可能,请发送屏幕截图,因为我可以更好地理解视觉效果您需要连接类中的第三个textfield topConstraint,并使用如下适当的值修改此约束 self.topConstraint.constant = topConstraint.constant - 50 self

这里我有三个文本字段,它们都被设置好了,现在我想要第三个文本字段的位置来代替第二个,一旦我隐藏了第二个文本字段,第三个文本字段的位置应该移到上面

这里,这个应该是这样的
请注意:我是自动布局的初学者,因此如果可能,请发送屏幕截图,因为我可以更好地理解视觉效果

您需要连接类中的第三个textfield topConstraint,并使用如下适当的值修改此约束

    self.topConstraint.constant = topConstraint.constant - 50
    self.view.layoutIfNeeded()

您需要连接类中的第三个textfield topConstraint,并使用如下适当的值修改此约束

    self.topConstraint.constant = topConstraint.constant - 50
    self.view.layoutIfNeeded()

你找到解决方案了吗?你找到解决方案了吗?