如何单独为iPhone X设备设置约束

时间:2017-09-15 15:20:56

标签: ios iphone ios11 iphone-x

我在故事板中有一个标识设置为值28的顶部约束,它适用于所有设备。在iPhone X设备上,它与顶部的相机条合并。如果我增加顶部约束,它会影响其他设备。我如何仅为iPhone X设置约束?

1 个答案:

答案 0 :(得分:7)

默认情况下,Xcode会在项目创建时为您提供fig = plt.figure() ax = fig.add_subplot(111, projection='3d') X = np.arange(-5, 5, 0.25) Y = np.arange(-5, 5, 0.25) X, Y = np.meshgrid(X, Y) Z = X + Y * 2 + 3 # Plot the surface. ax.plot_surface(X, Y, Z, linewidth=0) plt.show()

enter image description here

在这里,我添加了Safe Area以下约束。请注意约束如何固定到UIView,而不是Safe Areaenter image description here

运行该应用,您会看到该视图尊重所有设备的状态栏。

希望这有助于您解决的问题......