iOS app基础

本文深入解析iOS应用程序的基本架构,包括Info.plist文件的作用及其配置方法,应用程序如何通过UIApplicationDelegate进行初始化及状态转换,视图控制器的工作原理及窗口对象如何协调屏幕上的视图呈现。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

(一)

1). Info.plist : iOS通过它和app交互

 

  The Info.plist file contains metadata about your app, which the system uses to interact with your app.

  The Information Property List File

  Xcode uses information from the General, Capabilities, and Info tabs of your project to generate an information property list (Info.plist) file for your app at compile time. The Info.plist file is a structured file that contains critical information about your app’s configuration. It is used by the App Store and by iOS to determine your app’s capabilities and to locate key resources. Every app must include this file.

  Whenever possible, use the General and Capabilities tabs to specify the configuration information for your app. Those tabs contain the most common configuration options available for apps. If you do not see a specific option on either of those tabs, use the Info tab.

 

2). A declaration of the app’s required capabilities : 

 

The App Store uses this information to determine whether or not a user can run your app on a specific device.

 

3). app bundle

 

An iOS app bundle contains the app executable file and supporting resource files such as app icons, image files, and localized content.

For more information about the structure of an iOS app bundle, see Bundle Programming Guide. For information about how to load resource files from your bundle, see Resource Programming Guide.

 

 

(2):

The UIApplication object manages the event loop and other high-level app behaviors. It also reports key app transitions and some special events (such as incoming push notifications) to its delegate, which is a custom object you define. Use the UIApplication object as is—that is, without subclassing.

The app delegate is the heart of your custom code. This object works in tandem with the UIApplication object to handle app initialization, state transitions, and many high-level app events. This object is also the only one guaranteed to be present in every app, so it is often used to set up the app’s initial data structures.

 

(3):

View controller objects manage the presentation of your app’s content on screen. A view controller manages a single view and its collection of subviews. When presented, the view controller makes its views visible by installing them in the app’s window.

The UIViewController class is the base class for all view controller objects. It provides default functionality for loading views, presenting them, rotating them in response to device rotations, and several other standard system behaviors. UIKit and other frameworks define additional view controller classes to implement standard system interfaces such as the image picker, tab bar interface, and navigation interface.

For detailed information about how to use view controllers, see View Controller Programming Guide for iOS.

 

(4):

A UIWindow object coordinates the presentation of one or more views on a screen. Most apps have only one window, which presents content on the main screen, but apps may have an additional window for content displayed on an external display.

To change the content of your app, you use a view controller to change the views displayed in the corresponding window. You never replace the window itself.

In addition to hosting views, windows work with the UIApplication object to deliver events to your views and view controllers.

 

 

参考:App Programming Guide for iOS

转载于:https://www.cnblogs.com/cocoabanana/p/5541882.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值