Advanced IOS UI 03

Source: Internet
Author: User

Navigation Controller

1. The navigation controller always shows the view of the top controller

2. The navigation controller in the interface between the jump must get the navigation controller

3. Calling the Pop method does not immediately destroy the current controller

4.popToViewController use note, the incoming controller must be the controller in the navigation controller stack

5. The content of the navigation bar is determined by the stack top controller, a navigation controller has only one navigation bar, so it can only be determined by a controller, who first shows on the outermost, who is the stack top controller.

6. After iOS7, the image of the button on the navigation bar is rendered blue by default.

7. The sub-control location on the navigation bar does not require us to manage, only need to manage the size

8.UINavigationItem: is a model that determines the contents of the navigation bar (content on the left, middle, right)

    1. Uibarbuttonitem: is a model that determines the contents of a button on a navigation bar

10. As soon as you see the item, it is usually the apple-provided model that modifies some of Apple's controls as long as the model is changed.

1-life cycle of the Controller view
    1. The life cycle method of the controller's view begins with the view

    2. Viewdidload, Viewwillappear, Viewwilllayoutsubviews, Viewdidlayoutsubviews, Viewdidappear, Viewwilldisappear-Viewdiddisappear

3. Viewdidunload in non-arc, often used to clear the data on the interface

2-Data Storage 1.plist Storage

1.plist storage, generate a plist file.

2.plist is not an array or a dictionary, plist storage is used to store dictionaries or arrays.

注意:Plist不能存储自定义对象

3. Get the caches file path in the app sandbox

    // directory:获取哪个文件夹    // domainMask:在哪个范围内搜索,NSUserDomainMask:表示在用户的手机上查找    // expandTilde:是否展开全路径 YES:表示展开全路径 NO:不会展开全路径,会把应用沙盒的路径用波浪号(~)代替    // 获取到Caches文件夹路径    NSString *cachePath = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES)[0];

4. Read plist, what type of storage before, what is read

2. Preference Settings Storage
    // 偏好设置存储:NSUserDefaults    // 以字典的形式进行偏好设置,用法跟字典.    // 偏好设置好处:  1.不需要关心文件名    //              2.快速进行键值对存储    // 3.直接存储基本数据类型

@implementation Viewcontroller

-(Ibaction) Save: (ID) Sender {

Get a single case

Nsuserdefaults *defaults = [Nsuserdefaults standarduserdefaults];

@ "123" key:pwd

[Defaults setobject:@ "123" forkey:@ "pwd"];

bool

[Defaults setbool:yes forkey:@ "IsOn"];

Int

[Defaults setinteger:10 forkey:@ "num"];

}

-(Ibaction) read: (ID) Sender {

Using Nsuserdefaults single case

NSString *pwd = [[Nsuserdefaults standarduserdefaults] objectforkey:@ "pwd"];

Nsinteger i = [[Nsuserdefaults standarduserdefaults] integerforkey:@ "num"];

NSLog (@ "%@--%ld", pwd,i);

}

3. Archive

1.NSKeyedArchiver is designed to be used for custom object archiving

When to call: This method is called when an object is to be archived.Action: Tell Apple which attributes in the current object need to be archived-(void) Encodewithcoder: (Nscoder *) acoder{[Acoder encodeobject:_name Forkey:@ "name"]; [Acoder encodeint:_age Forkey:@ "age"];} //When to invoke: When an object is to be unpacked, this method is called to solve the file //function: Tell the apple which properties in the current object need to be solved //Initwithcoder when to call: Whenever parsing a file, it will be called-(ID) Initwithcoder: (Nscoder *) adecoder{ #warning [Super Initwithcoder] if (self= [Super init]) { //solution  //Note Be sure to remember to assign a value to the member property _name = [Adecoder decodeobjectforkey: @ "name"]; _age = [Adecoder decodeintforkey:@ "age"];} return self ;}              

Advanced IOS UI 03

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.