草庐IT

nslayoutconstraint

全部标签

swift - 如何更改 UIAlertController 高度?

我创建了一个UIAlertControllerletalertC=UIAlertController(title:"Title",message:"Message",preferredStyle:UIAlertControllerStyle.Alert)alertC.addTextFieldWithConfigurationHandler(addTextField)alertC.addAction(UIAlertAction(title:"Cancel",style:UIAlertActionStyle.Default,handler:nil))alertC.addAction(UIA

swift - 如何更改 UIAlertController 高度?

我创建了一个UIAlertControllerletalertC=UIAlertController(title:"Title",message:"Message",preferredStyle:UIAlertControllerStyle.Alert)alertC.addTextFieldWithConfigurationHandler(addTextField)alertC.addAction(UIAlertAction(title:"Cancel",style:UIAlertActionStyle.Default,handler:nil))alertC.addAction(UIA

swift - 以编程方式创建约束以查看 Controller 边距

我正在尝试制作一个View,该View将充当一种“面板”,附加到ViewController的右侧。即绑定(bind)到父ViewController的尾边距、上边距和下边距,静态宽度为300但是,我似乎无法正确处理,我要么打破约束,要么做一些xcode告诉我是非法的事情。我做错了什么?Controller中的代码letmyView=UIView()view.backgroundColor=UIColor.redColor()self.view.addSubview(view)lettopConstraint=NSLayoutConstraint(item:myView,attribu

swift - 以编程方式创建约束以查看 Controller 边距

我正在尝试制作一个View,该View将充当一种“面板”,附加到ViewController的右侧。即绑定(bind)到父ViewController的尾边距、上边距和下边距,静态宽度为300但是,我似乎无法正确处理,我要么打破约束,要么做一些xcode告诉我是非法的事情。我做错了什么?Controller中的代码letmyView=UIView()view.backgroundColor=UIColor.redColor()self.view.addSubview(view)lettopConstraint=NSLayoutConstraint(item:myView,attribu

swift - 你如何设置带有图像的 UIButton 的高度和宽度

这让我抓狂。我到处都看过,但无法弄清楚。检查一下...letfindMeButton=UIButton(type:UIButtonType.System)findMeButton.translatesAutoresizingMaskIntoConstraints=falsefindMeButton.setImage(UIImage(named:"locateMe"),forState:UIControlState.Normal)findMeButton.addTarget(self,action:#selector(MapViewController.findUserLocation(

swift - 你如何设置带有图像的 UIButton 的高度和宽度

这让我抓狂。我到处都看过,但无法弄清楚。检查一下...letfindMeButton=UIButton(type:UIButtonType.System)findMeButton.translatesAutoresizingMaskIntoConstraints=falsefindMeButton.setImage(UIImage(named:"locateMe"),forState:UIControlState.Normal)findMeButton.addTarget(self,action:#selector(MapViewController.findUserLocation(

ios - 使用 constraintEqualToAnchor() 时如何在设置自动布局约束后更改它们?

我尝试使用constraintEqualToAnchor()设置一个带有AutoLayout约束的View:overridefuncviewDidLoad(){super.viewDidLoad()letmyView=UIView()myView.backgroundColor=UIColor.orangeColor()myView.translatesAutoresizingMaskIntoConstraints=falseview.addSubview(myView)myView.leftAnchor.constraintEqualToAnchor(view.leftAnchor)

ios - 使用 constraintEqualToAnchor() 时如何在设置自动布局约束后更改它们?

我尝试使用constraintEqualToAnchor()设置一个带有AutoLayout约束的View:overridefuncviewDidLoad(){super.viewDidLoad()letmyView=UIView()myView.backgroundColor=UIColor.orangeColor()myView.translatesAutoresizingMaskIntoConstraints=falseview.addSubview(myView)myView.leftAnchor.constraintEqualToAnchor(view.leftAnchor)

ios - 在生产中捕获 UIViewAlertForUnsatisfiableConstraints

是否有可能在生产中捕获自动布局约束歧义-相当于UIViewAlertForUnsatisfiableConstraints断点但对于生产应用程序?我的目标是添加一个全局处理程序,将此类错误报告给日志系统。 最佳答案 符号UIViewAlertForUnsatisfiableConstraints实际上是一个函数:_UIViewAlertForUnsatisfiableConstraints(NSLayoutConstraint*unsatisfiableConstraint,NSArray*allConstraints).它是私有(

ios - 在生产中捕获 UIViewAlertForUnsatisfiableConstraints

是否有可能在生产中捕获自动布局约束歧义-相当于UIViewAlertForUnsatisfiableConstraints断点但对于生产应用程序?我的目标是添加一个全局处理程序,将此类错误报告给日志系统。 最佳答案 符号UIViewAlertForUnsatisfiableConstraints实际上是一个函数:_UIViewAlertForUnsatisfiableConstraints(NSLayoutConstraint*unsatisfiableConstraint,NSArray*allConstraints).它是私有(