Then the header and implementation files of this class are very easy.
4 , the parent Class View initialization problem In the view class ground-(void) Viewdidload function, you should start by running the following statement: [Super Viewdidload]; The statement that runs its parent-class Viewdidload method will help us do some initialization work. Otherwise, it may cause errors to occur when we invoke certain methods.
5, Message Notification Nsnotificationcenter Purpose: Nsnotificationcenter is set up specifically for communication between non-homogeneous messages in the program.
Notice of registration:[[Nsnotificationcenter defaultcenter] addobserver:self selector: @selector (mytest:) name:@ "MyTest" object:nil]; description of the parameters:Addobserver: The Observer, where the notice is received;Selector: What method to call after receiving notification;Name : The notification is named, and is the only indication of the notification, the compiler will find the notification through this.
Send notification: Invokes the method at the Observer. [[Nsnotificationcenter Defaultcenter] postnotificationname:@ "mytest" Object:searchfriendarray];description of the parameters:Postnotificationname: The name of the notification. is also the only indication of the notification, the compiler will find the notification through this. object: The number of parameters passed
[2013.5.15] added: nsnotificationcenter usage with a number of parameters:Generally, the use of nsnotificationcenter is not used, but there are some times when you need to use a number of parameters. The pass-through parameter is shown here to pass an array of tekubaarray:[[nsnotificationcenter Defaultcenter] postnotificationname:@ "Tekubadata" object: Tekubaarray]; receive a reference and get the number of parameters passed[[Nsnotificationcenter defaultcenter] addobserver:self selector: @selector (Tekubatestname:@ "Tekubadata[Object:nil];Postnotificationname: The name of the notification, is also the only indication of the notification, the compiler to find the notification through this. Object: The number of parameters passed-(void) Tekubatest: (nsnotification*) Notification{nsmutablearray* DataArray = [notification object];//through this gets to the passed object}6,attribute list Nsuserdefaultswhen the amount of data stored is very small, you can use multiple rows of key-value to save and read data.
Demo Sample:get information on Cuseridnsstring *usernameid=[[nsuserdefaults standarduserdefaults] valueforkey:@ "Cuserid"];save a Knumberlocationkey key to Numberlocation. Data with a value of 123456. nsstring *knumberlocationkey = @ "Numberlocation";nsstring *savenumber = @ "123456″;[[Nsuserdefaults standarduserdefaults] Setobject:savenumber Forkey:knumberlocationkey];
7,multiple parameter issues in iOS programming-(void) Createstreamer: (UIView *) View urlstring: (NSString *) urlstring{}the parameters are each view. and URLString
8,use of the Nstimer timerNstimer is actually the runloop of a system that listens to an increase, when the system Runloop to how the timer condition loops. Will call the timer once, when the timer runs out. That is, after the callback function is run, the timer will add itself to the Runloop again to continue listening. Demo Sample:[Nstimerscheduledtimerwithtimeinterval:1target:selfselector: @selector (updateprogress:)Userinfo:viewRepeats:yes];description of the parameters:scheduledtimerwithtimeinterval: (nstimeinterval) secondsBook a timer. Set a time interval. implicitly enter a time interval object, in seconds. The value of a >0 floating-point type. If the value is <0. System will feel 0.1target: (ID) atargetimplicitly sent objects, such as selfor: (SEL) Aselectormethod Selector, within the time interval. Select Invoke an instance methodUserInfo: (ID) userInfoThis parameter can feel nil when the timer expires. The timer is saved and released by the object you specify. repeats: (BOOL) YesornoWhen Yes, the timer will renew the cycle until it expires or be released, and when no, the timer will be sent once in a cycle to fail.
Invocation: (nsinvocation *) invocation
9, Xcode output form print NSData data NSData *tempdata;//If TempData has populated the data NSLog (@ "\n%@\n", [[NSString alloc] Initwithdata:tempdata encoding:nsutf8stringencoding]);//print data to get data. The test can correctly print out the string in the TempData.
of course, can also use NSLog (@ "\n%@\n", tempdata);//Direct printing, when the test results are printed in the form of 16 of paper
Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.
iOS Research iOS Development Notes Learning Basics