First, using XML to obtain data
1. Write XML file tree structure root node
(1). <?xml version= "1.0" encoding = "Utf-8"?>
(2). Setting the root node
(3). Set child nodes, like child node names, copy directly
(4). Set Child nodes tab, copy
(5). Type the contents of the label
2. Use Terminal (note: In Unix systems, the A.txt is not equal to the uppercase and lowercase characters, not the a.txt. )
(1) Open terminal: control+ space, Ter->enter (default to the user root directory)
(2) cmd++ Zoom cmd+-Zoom Out
(3 ls: view the catalog document
Ls-a: View all document Catalogs
~: User root directory
/: System root directory
CD: Enter directory
CD, enter the Prefix TAB key can be auto-complete (two tab can prompt the same file name)
Cd.. : Go to the top level directory
PWD: Displays the absolute path of the current path
Clear: Clear Screen
3. Open Apache
(1) sudo apachectl start
sudo: Get the highest privileges
APACHECTL: abbreviation for Apache Ctl:control
Start: Open
(2) Enter the password, do not display anything
(3) Open browser-type http://127.0.0.1/-> display It works!-> indicates that Apache has been opened
(4) Go to computer->macintosh HD---Library->webserver->webserver->documents
(5) Copy the XML file to the document, enter password, open Web page, and enter the full name of the filename after HTTP://127.0.0.1/
(6) Copy the browser address
(7) using Nsurl package address
(8) Obtaining a request
(9) Asynchronously fetching data using nsurlconnection
Ii. Use of MVC
1. Building the framework
(1) showinfinder-> new folder (Models,views,controller,third,handle)->add to Files, select the 5 folders created->groups-> Engineering Draw Hook->add
(2) Copy third-party folder, paste to third folder->add to Files-select third-party folder->add->cmd+b compile
(3) Select the project name->showinfinder-> in the same directory as the project file, new folder-Name must be frameworks->add to Files-Select Frameworks Folder->add
(4) Add frame support, auto to frameworks folder
2. Create a class
(1) Controller folder
Create a root controller that inherits Uitableviewcontroller->cmd+opt+n create a group (qq,phone,music)
Music: Creating a QQ Musical controller that inherits Uitableviewcontroller
Phone: Create a mobile controller that inherits Uiviewcontroller, without Xib, use VC to separate
QQ: Create the QQ controller that inherits Uiviewcontroller, add Xib
(2) Handle folder
Create a class that inherits NSObject to get network data
(3) Models folder
Create a class that inherits NSObject for creating properties
Three. The currently learned Singleton class
1.[nsnotificationcenter Defaultcenter]
2.[nsfilemanager Defaultmanager]
3.[uiapplication Sharedapplication]
4.[uidevice Currentdivece]
5.[nsurlsession Sharedsession]
6. Custom Handle Singleton class
(1) Write a class method in. h, using shared naming.
(2) Define static global objects in. m, set to NULL
(3) in the. M implementation class method, using the Dispatch_once Sinppet-gcd:dispatch once method, in the function body, initializes the static global object with the class name
Four. global macro name Symbol
0.Supporting files->cmd+n->other->pch file-> Select project->build Settings->cmd+f->prefix-> type $ ( Srcroot)/day5 Life service mvc/project.pch
1.showinfinder-> new Folder->myfile->add to Files, select the Created MyFile folder->add
2.cmd+n->source->header file-> macro defines the 3 symbols in the notification hub #import导入. h file in the PCH
iOS network programming--day5 (using MVC to turn on Apache)