iOS11-PDFKit-Example 项目教程
1. 项目的目录结构及介绍
iOS11-PDFKit-Example/
├── README.md
├── iOS11-PDFKit-Example
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ └── Contents.json
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── Info.plist
│ ├── ViewController.swift
│ └── main.swift
└── iOS11-PDFKit-Example.xcodeproj
├── project.pbxproj
└── xcuserdata
目录结构说明
- README.md: 项目说明文件。
- iOS11-PDFKit-Example: 项目主目录。
- AppDelegate.swift: 应用程序的入口和生命周期管理。
- Assets.xcassets: 应用的资源文件,包括应用图标。
- Base.lproj: 本地化资源,包含启动屏幕和主故事板。
- Info.plist: 应用的配置文件。
- ViewController.swift: 主视图控制器。
- main.swift: 应用的启动文件。
- iOS11-PDFKit-Example.xcodeproj: Xcode 项目文件。
2. 项目的启动文件介绍
main.swift
import UIKit
UIApplicationMain(
CommandLine.argc,
CommandLine.unsafeArgv,
nil,
NSStringFromClass(AppDelegate.self)
)
main.swift
是应用程序的启动文件,负责调用 UIApplicationMain
函数来启动应用,并指定 AppDelegate
作为应用的委托类。
3. 项目的配置文件介绍
Info.plist
Info.plist
是应用的配置文件,包含应用的基本信息和配置选项,例如应用的显示名称、版本号、权限设置等。以下是一些常见的配置项:
<key>CFBundleDisplayName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
配置文件说明
- CFBundleDisplayName: 应用的显示名称。
- CFBundleExecutable: 可执行文件的名称。
- CFBundleIdentifier: 应用的唯一标识符。
- CFBundleName: 应用的名称。
- CFBundlePackageType: 包类型,APPL 表示应用程序。
- CFBundleShortVersionString: 应用的版本号。
- CFBundleVersion: 应用的构建版本号。
- LSRequiresIPhoneOS: 表示应用需要在 iOS 设备上运行。
- UILaunchStoryboardName: 启动屏幕的故事板文件名。
- UIMainStoryboardFile: 主故事板文件名。
- UIRequiredDeviceCapabilities: 应用所需的设备功能。
- UISupportedInterfaceOrientations: 支持的界面方向。
以上是 iOS11-PDFKit-Example
项目的目录结构、启动文件和配置文件的详细介绍