iOS 出现 'NSInternalInconsistencyException', reason: 'Client error attempting to change layout margins of a private view
这个只有 iOS 13 以上版本才会出现,解决办法就是
if (@available(iOS 13.0, *)) { UIEdgeInsets margins = view.layoutMargins; CGRect frame = view.frame; frame.origin.x = -margins.left; frame.origin.y = -margins.top; frame.size.width += (margins.left + margins.right); frame.size.height += (margins.top + margins.bottom); view.frame = frame; } else { view.layoutMargins = UIEdgeInsetsZero; }
目前尚无回复