关于Masonary布局与NSAutoresizingMaskLayoutConstraint冲突问题

在项目中出现下面的警告,虽然界面上没出现错误,但是对于有强迫症的程序员来说是难以忍受的。百度后发现一句代码就解决问题了。

[LayoutConstraints] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
    (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "",
    "",
    ""
)

一般情况下加入这句代码就行了:

self.translatesAutoresizingMaskIntoConstraints = NO;

你可能感兴趣的:(关于Masonary布局与NSAutoresizingMaskLayoutConstraint冲突问题)