这是我的UISegmentedControl代码:
sp:::plot.SpatialPolygons
正如您所看到的,我正在为UISegmentedControl添加约束,但我的应用程序崩溃了。这是我的错误消息:
2015-09-03 18:50:52.241员工守护者[14424:11105086] *由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'* + [NSLayoutConstraint constraintWithItem:attribute:relatedBy :toItem:attribute:multiplier:constant:]:乘数0或第二个项与第一个属性的位置一起创建一个等于常量的位置的非法约束。必须成对指定位置属性 ***首先抛出调用堆栈:
我做错了什么?
答案 0 :(得分:4)
我认为这是因为当你设置约束时你的self.searchController.searchBar
是nil