刚学autolayout,关于这个问题,一直没搞清楚!疑惑一:多个view(label)如何设置居中显示?c[backviewaddConstraints:[NSLayoutConstraintconstraintsWithVisualFormat:@"H:|[lab_before][lab_middle][lab_after]|"options:0metrics:nilviews:NSDictionaryOfVariableBindings(lab_before,lab_middle,lab_after)]];枚举类型参数中:ctypedefNS_OPTIONS(NSUInteger,NSLayoutFormatOptions){NSLayoutFormatAlignAllLeft=(1<NSLayoutFormatAlignAllRight=(1< NSLayoutFormatAlignAllTop=(1< NSLayoutFormatAlignAllBottom=(1< NSLayoutFormatAlignAllLeading=(1< NSLayoutFormatAlignAllTrailing=(1< NSLayoutFormatAlignAllCenterX=(1< NSLayoutFormatAlignAllCenterY=(1< NSLayoutFormatAlignAllBaseline=(1< NSLayoutFormatAlignAllLastBaseline=NSLayoutFormatAlignAllBaseline, NSLayoutFormatAlignAllFirstBaselineNS_ENUM_AVAILABLE_IOS(8_0)=(1< NSLayoutFormatAlignmentMask=0xFFFF,疑惑2:参数中的NSLayoutFormatAlignAllCenterX,该如何使用?每次使用都回报错!附上报错信息:cNSInvalidArgumentException|Unabletoparseconstraintformat:\nOptionsmaskrequiredviewstobealignedonahorizontaledge,whichisnotallowedforlayoutthatisalsohorizontal.\nH:|[lab_before][lab_middle][lab_after]|\n^|(\n\"4libc++abi.dylib0x0000000192c65bb4+16\",\n\"5libc++abi.dylib0x0000000192c65478 +0\",\n\"6libobjc.A.dylib0x0000000193478204 +0\",\n\"7Foundation0x0000000183ce11cc +0\",\n\"8Foundation0x0000000183b6bf44 +1296\"\n)|iPhoneOS|8.1|1.0.0|iPhone7,1"; }]希望,各位大神指教!
弑天下
狐的传说
相关分类