I. Overview
Since object-C is used, the entry is the same as the C language, which is the main function. You can see a main. m in the newly created Project. Here is the entry. What is the difference between the entry and the C language? Uiapplicationmain.
The definition of the uiapplicationmain function is as follows:
Int uiapplicationmain (
Int argc,
Char * argv [],
Nsstring * principalclassname,
Nsstring * delegateclassname
);
Parameters
Argc
The Count of arguments in argv; this usually is the corresponding parameter to main.
Argv
A Variable list of arguments; this usually is the corresponding parameter to main.
Principalclassname
The name of the uiapplication class or subclass. If you specify nil, uiapplication is assumed.
Delegateclassname
The name of the class from which the application delegate is instantiated. if principalclassname designates a subclass of uiapplication, you may design the subclass as the delegate; The subclass instance has es the application-delegate messages. specify
Nil if you load the delegate object from your application's main NIB file.
Return Value
Even though an integer return type is specified, this function never returns. When users exits an iPhone application by pressing the Home button, the application moves to the background.
The first two parameters are familiar with the C language, so you don't need to introduce them. Let's talk about the next two parameters.
Principalclassname is the name of the uiapplication class or its subclass. If it is nil, the default value is uiapplication.
Delegateclassname refers to the delegate class name. If it is nil, it refers to the delegate class name specified in your master NIB file. In a project, you do not need to change anything in the main function, because it is all designed for you when creating the project in xcode, what you need to change is mainly in one of your plist files, the name is xxx-info.plist. The main NIB file base name in the base name is the name of the current master NIB file, which is mainwindow by default. Bundle display name is the name displayed when the application is loaded to the mobile phone. Icon
File is the specified app icon. Another important thing is bundle identifier, which is important to identify the uniqueness of programs on mobile phones.
Ii. startup screen and app icon
Next, let's talk about the iPhone startup screen and app icon.
The icon file mentioned above can be used to change the app icon. There is also a simpler method, that is, simply put the images of the specified size into the project. The specific implementation is too lazy to write, just copy a copy of the information:
IOS devices now have three different resolutions:
IPhone 320x480,
IPhone 4 640x960,
IPad 768x1024.
You can use the original program to start the image watermark (only default.png can be used for the image watermark, but it is much more complicated now.
If a program supports both iPhone and iPad, it must contain the following images:
Default-Portrait.png iPad dedicated vertical boot screen 768x1024 or 768x1004
Default-Landscape.png iPad dedicated landscape boot screen 1024x768 or 1024x748
Default-PortraitUpsideDown.png iPad dedicated vertical boot screen (Home button on screen), can omit 768x1024 or 768x1004
Horizontal boot screen for Default-LandscapeLeft.png iPad, omitted 1024x768 or 1024x748
Horizontal boot screen for Default-LandscapeRight.png iPad, omitted 1024x768 or 1024x748
Default.png iPhone default boot image, 320xlarge or 320x460
Default@2x.png iphone4 boot pictures 640x960 or 640x920
To use the above boot screen on the iPad, you also need to add it to info. plist.
Key: uisupportedinterfaceorientations.
Add Value
Uiinterfaceorientationportrait
Uiinterfaceorientationportraitupsidedown
Uiinterfaceorientationlandscapeleft
Uiinterfaceorientationlandscaperight.
The above figure shows the startup screen. Copy the app icon as follows:
Icon sizes for iOS (iPhone, iPad and iPod Touch)
Here are the icon sizes from
IOS Human Interface Guidelines.
Description |
Size for iPhone and iPod Touch |
Size for iPad |
Application icon (required) |
57x57 114x114 (iphone4) |
72X72 |
App Store icon (required) |
512x512 |
512x512 |
Small icon (recommended) |
29x29 58x58 (iphone4) |
50x50 for Spotlight search results 29x29 for settings |
Ii. Table View
Let's talk about the main method in detail later. After more than a month's summary, the iPhone classes are actually quite complete, basically using the delegate method.
3. Animation
Currently, I have summarized three types.
1. directly use
+ (Void) beginanimations :( nsstring *) animationid context :( void *) context; // additional context info passed to will start/did stop selectors. Begin/commit can be nested
+ (Void) commitanimations;
Example:
Official code:
[Uiview beginanimations: @ "animationid" context: Nil];
[Uiview setanimationduration: 0.5f];
[Uiview setanimationcurve: uiviewanimationcurveeaseinout];
[Uiview setanimationrepeatautoreverses: No];
Uibutton * thebutton = (uibutton *) sender;
Switch (thebutton. Tag ){
Case 0:
[Uiview setanimationtransition: uiviewanimationtransitionflipfromleft forview: Self. View cache: Yes]; // oglflip, fromleft
Break;
Case 1:
[Uiview setanimationtransition: uiviewanimationtransitionflipfromright forview: Self. View cache: Yes]; // oglflip, fromright
Break;
Case 2:
[Uiview setanimationtransition: uiviewanimationtransitioncurlup forview: Self. View cache: Yes];
Break;
Case 3:
[Uiview setanimationtransition: uiviewanimationtransitioncurldown forview: Self. View cache: Yes];
Break;
Default:
Break;
}
[Self. View exchangesubviewatindex: 1 withsubviewatindex: 0];
[Uiview commitanimations];
2. Use catransition
There are two types:
(1) Public
Catransition * animation = [catransition animation];
// Animation. Delegate = self;
Animation. Duration = 0.5f;
Animation. timingfunction = uiviewanimationcurveeaseinout;
Animation. fillmode = kcafillmodeforwards;
// Animation. removedoncompletion = no;
Uibutton * thebutton = (uibutton *) sender;
/*
Kcatransitionfade;
Kcatransitionmovein;
Kcatransitionpush;
Kcatransitionreveal;
*/
/*
Kcatransitionfromright;
Kcatransitionfromleft;
Kcatransitionfromtop;
Kcatransitionfrombottom;
*/
Switch (thebutton. Tag ){
Case 0:
Animation. type = kcatransitionpush;
Animation. Subtype = kcatransitionfromtop;
Break;
Case 1:
Animation. type = kcatransitionmovein;
Animation. Subtype = kcatransitionfromtop;
Break;
Case 2:
Animation. type = kcatransitionreveal;
Animation. Subtype = kcatransitionfromtop;
Break;
Case 3:
Animation. type = kcatransitionfade;
Animation. Subtype = kcatransitionfromtop;
Break;
Default:
Break;
}
[Self. View. layer addanimation: animation forkey: @ "Animation"];
(2) Private
Catransition * animation = [catransition animation];
Animation. Delegate = self;
Animation. Duration = 0.5f * slider. value;
Animation. timingfunction = uiviewanimationcurveeaseinout;
Animation. fillmode = kcafillmodeforwards;
Animation. endprogress = slider. value;
Animation. removedoncompletion = no;
Uibutton * thebutton = (uibutton *) sender;
Switch (thebutton. Tag ){
Case 0:
Animation. type = @ "cube ";//---
Break;
Case 1:
Animation. type = @ "suckeffect"; // 103
Break;
Case 2:
Animation. type = @ "oglflip"; // when subtype is "fromleft" or "fromright", it's the official one.
Break;
Case 3:
Animation. type = @ "rippleeffect"; // 110
Break;
Case 4:
Animation. type = @ "pagecurl"; // 101
Break;
Case 5:
Animation. type = @ "pageuncurl"; // 102
Break;
Case 6:
Animation. type = @ "camerairishollowopen"; // 107
Break;
Case 7:
Animation. type = @ "camerairishollowclose"; // 106
Break;
Default:
Break;
}
[Self. View. layer addanimation: animation forkey: @ "Animation"];
References:
Http://www.visualpharm.com/articles/icon_sizes.html
Http://news.wangmeng.cn/detailNews/2984-iphone-start-page-default-png
And the official code example uiviewdemo 2.