今天讲Xcode如何创建ios的布局文件,storyboard文件。今天讲的是拖动创建布局的方式,即所见即所得的那种简单创建布局的方式。ios的布局管理工具是Xcode内嵌的IB,即Interface Builder,布局文件的后缀是.storyboard。具体如下:
Use
Interface Builder to visually lay out your app's user interface. To edit the user interface, select a user interface file in the project navigator (), and the file opens in Interface Builder in the editor area. All projects created from a template contain
a Main.storyboard file that contains the user interface for your app. For watchOS apps, the file is called Interface.storyboard. For iOS apps, there’s also a LaunchScreen.storyboard file for the view that is displayed while the app is launching. A storyboard
(.storyboard) file contains a set of view controllers and their views. To open Interface Builder in a separate window, double-click the user interface file in the project navigator.
The
canvas will show your user interface as it appears on a device. For iOS and watchOS apps, the first time you open a storyboard file, a sheet appears asking you to choose a device family (for example, iPhone 6s or Apple Watch 38mm). Later, you can change the
device using the device configuration controls below the canvas.
The library in the utility area contains resources that you can add to your project or files. To add an object to the user interface, drag the resource from the Object library () to the canvas. To view the objects as a list or as a grid, toggle the icon in
the lower-left corner of the library. To filter the objects, enter text in the filter bar at the bottom of the library. For example, to find a button, enter button in the filter bar.