IOS make Address Book--study notes in Lan Yi education

Source: Internet
Author: User

From Lan Yi Education student Notes

1, delete the VC in the interface, and establish a TABLEVC, create a navigation in SB, and associate the attribute in TableView, and let the arrow point to the navigation of the first page, and associate the cell

2. Drag-and-drop interface view Controller to establish a personviewcontroller to make it associated with SB,

3, in the TABLEVC to establish the upper left corner of the plus

4. Associate the PERSONVC property, and write an event in the event method in the upper-left corner of the plus sign

5, delete the extra lines in the Vdidload (left to add the upper right corner of the delete button code);

6, set up the array persons, and initialize,

7, the number of lines in the required method to indicate return self.persons.count;

8. Before writing the content in each line, create the person object and the. A string that declares a name and number in H (copy)

9. Import person in TABLEVC. H, put in the content that was displayed in each line just now,

Person *person = Self.persons[indexpath.row];

Cell.textLabel.text =person.name;

Cell.detailTextLabel.text = Person.number;

10. Change the attribute in the first line of the cell in SB to right Detall

11, in TABLEVC

Add tests to the Vdidload,

Person *p =[[person alloc]init];

P.name =

P.number=

[Self.persons Addobject:p];

and add the title;

You can now jump to the second page

11, associated with the second page PERSONVC tf and button, Impot Penson object

Enter button

Person *p = [[Person alloc]init]l

P.name= Self.nametf.text;

P.numebr = ....;

12, to reverse call ———— in PERSONVC. H adds a impot to a TABLEVC. Create a TABLEVC delegate

13, in the PVC addaction click to jump when self.delegate= self;

14, in TABLEVC. H Create method: Imports import person. H and create a method to add a person's event;

And then in. m removes the imported import, and to implement the method Addperson, the passed-in person is displayed in the array.

And to refresh the display,

15, at this time the second interface PERSONVC can input self.delegate addperson:p;

And when you click on the button, you can return to the interface

———————— implement click on each line to enter ————————

16, implementation of the TABLEVC in the TableView Click event Realization, in the inside out in a row click on the person object to take out

But before going into person's position (in PERSONVC), declare an object Editperson (strong) To edit the object's meaning

And then return to Vableview.

17, into the PERSONVC to pass the information transmitted to Vdidload

Judge whether Editperson has value, value is edit, no value is added;

and add a self.delegate = self in the edit event of TABELVC;

IOS make Address Book--study notes in Lan Yi education

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.