2015/10/6 Common Files in IOS notes detail app

Source: Internet
Author: User
Tags uikit

1, project name-info.plist file

Bundle Display Name app displays names (10 to 12 characters, more than displayed ...) )

Unique identifier of the bundle identifier app Com.xx.hhxx

Bundle version Software release number

Supported interface Orientation screen rotation default supports three modes

2, the application of common file Engineering name-PREFIX.PCH (the new version does not have this file)

The contents of the PCH header file can be shared and accessed by all other source files in the project

In general, some global macros are defined in the PCH header file

Add the following preprocessing directives in the PCH file, and then use the log (...) in your project. To output the log information,

It is possible to remove the NSLog statement at once when the application is published (in debug mode, debug is defined)

#ifdef __objc__

#import <UIKit/UIKit.h>

#import <Foundation/Foundation.h>

#define Age 28

#define Servertel @ "13531234234"

#import "HMPerson.h"

Debug mode

#ifdef DEBUG

#define HMLOG (...) NSLog (__va_args__)

#else

Release mode (release)

#define HMLOG (...)

#endif

---------------------------------------------------------------------------------------------------------------

UIApplication objects are symbols of the application

Each application has its own UIApplication object, and it is a singleton

This singleton object can be obtained by [UIApplication Sharedapplication]

The first object created after an iOS program is started is a UIApplication object

Use the UIApplication object to perform some application-level operations

Set the red reminder number in the upper-right corner of the application icon

@property (nonatomic) Nsinteger applicationiconbadgenumber;

Setting the visibility of networking indicators

@property (nonatomic,getter=isnetworkactivityindicatorvisible) BOOL networkactivityindicatorvisible;

Starting with IOS7, the system provides 2 ways to manage the status bar

Through Uiviewcontroller management (each uiviewcontroller can have its own different status bar)

Managed by UIApplication (the status bar of an application is unified by it)

In IOS7, by default, the status bar is managed by Uiviewcontroller, and Uiviewcontroller can easily manage the visibility and style of the status bar by implementing the following methods

Style of the status bar

-(Uistatusbarstyle) Preferredstatusbarstyle;

Visibility of the status bar

-(BOOL) Prefersstatusbarhidden;

If you want to use uiapplication to manage the status bar, you first need to modify the Info.plist settings

UIApplication has a very powerful OpenURL: method

-(BOOL) OpenURL: (nsurl*) URL;

OpenURL: Some of the functions of the method are

Call

UIApplication *app = [UIApplication sharedapplication];

[App Openurl:[nsurl urlwithstring:@ "tel://10086"];

Texting

[App Openurl:[nsurl urlwithstring:@ "sms://10086"];

Send e-mail

[App Openurl:[nsurl urlwithstring:@ "Mailto://[email protected]"];

Open a Web resource

[App Openurl:[nsurl urlwithstring:@ "http://ios.itcast.cn"];

Open Other app Programs

All mobile operating systems have a fatal disadvantage: apps are vulnerable to interruptions. For example, a call or lock screen will cause the app to go backstage or even be terminated.

There are a number of other similar situations that can cause the app to be disturbed, causing some system events when the app is disturbed, and UIApplication notifies its delegate object, allowing the delegate agent to handle these system events

Delegate events that can be handled include:

Application lifecycle events (such as program startup and shutdown)

System events (such as incoming calls)

Memory warning

... ...

A uiapplicationmain function is executed in the main function.

int uiapplicationmain (int argc, char *argv[], nsstring *principalclassname, NSString *delegateclassname);

ARGC, argv: direct transfer to Uiapplicationmain for related processing can be

Principalclassname: Specifies the application class name (symbol of the app), which must be uiapplication (or subclass). If nil, use the UIApplication class as the default value

Delegateclassname: Specifies the application's proxy class, which must comply with the Uiapplicationdelegate protocol

The Uiapplicationmain function creates a UIApplication object based on Principalclassname and creates a delegate object from Delegateclassname. and assigns the delegate object to the delegate property in the UIApplication object

The application's main Runloop (the event loop) is then created, and the event is processed (the application:didfinishlaunchingwithoptions of the delegate object is called first after the program is completed: method)

The Uiapplicationmain function returns when the program exits normally

2015/10/6 Common Files in IOS notes detail app

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.