1. How to stop UIView animations:
#import <QuartzCore/QuartzCore.h> [self.view.layer removeallanimations];2. Block page value-passing method: 3. UITableViewCell cell coordinate conversion cell relative Self.view positioning: CGRect rect=[self.view convertRect:cell.frame Fromview:tableview]; Locate the relative position of the cell on the cell after the button gets the relative position of the other controls can be found 4. Sort by file creation time NSLog (@ "Cheng%@", Cheng); Nssortdescriptor*sorter=[[nssortdescriptor alloc]initwithkey:@ "CreateDate" ascending:no];//descending Nsmutablearray *sortdescriptors=[[nsmutablearray alloc]initwithobjects:&sorter count:1]; NSArray * Sortarray=[cheng sortedarrayusingdescriptors:sortdescriptors]; [Sorter release]; NSLog (@ " Then%@ ", Sortarray); 5.IOS go to file suffix first method: Nsarray *result = [FileName componentsseparatedbystring:@"]; if (result.count! = 2) { return; } NSString *filet Itle = [result objectatindex:0]; NSString *filetype = [result objectatindex:1]; second party: nsstring * filename;//file name nsrange range = [sourcefile rangeofstring:@ "." Options: nsbackwardssearch]; if (range.length>0) filename=[data.m_strtitle Substringtoindex:nsmaxrange (range)]; The second kind can exclude the file name with the. Case 6.UIWebView hidden drag/drop shadow/Hide Shadow for ( UIView *subview in [M_webview subviews]) { if ([SubView iskindofclass: [Uiscrollview class]]) { for (UIView *shadowview in [SubView Sub views]) { if ( [Shadowview Iskindofclass:[uiimageview class]]) {Shadowview.hidden = yes; } } }  }7. Take control on cell via tag [Cell.contentview viewwithtag:tag]; 8.nsstring encode utf8//nsstring encoding, Resolve URL hollow Lattice and kanji NSString * urlstring= (NSString *) cfurlcreatestringbyaddingpercentescapes (Kcfallocatordefault, ( CFSTRINGREF) Urlstr, nil, Nil,kcfstringencodingutf8); 9.ios get thumbnails of local videos + (UIImage *) GetImage: (NSString *) Videourl { Avurlasset *asset = [[Avurlasset alloc] Initwithurl:[nsurl Fileurlwithpath:videourl] options:nil]; Avassetimagegenerator *gen = [[Avassetimagegenerator alloc] initwithasset:asset]; Gen.appliespreferredtracktransform = yes; Cmtime time = cmtimemakewithseconds (0.0, +); Nserror *error = nil; Cmtime actualtime; Cgimageref image = [Gen Copycgimageattime:time actualtime:&actualtime error:&error]; UIImage *thumb = [[UIImage alloc] initwithcgimage:image]; cgimagerelease (image); return thumb; } need to add Avfoundation and coremedia.framework 10. Verifying picture Validity-(BOOL) Isjpegvalid: (NSData *) JPEG { if ([JPEG length] < 4) return no; const char * bytes = (const char *) [JPEG bytes]; if (bytes[0]! = 0xFF | | bytes[1]! = 0xd8) return no; if (bytes[[jpeg length]-2]! = 0xFF | | bytes[[jpeg length]-1]! = 0XD9) return no; & nbsp return YES;} 11.uibutton title alignment m_btncode.titlelabel.textalignment=uitextalignmentleft;//useless need to use [M_btncode Setcontenthorizontalalignment:uicontrolcontenthorizontalalignmentleft];12.ios Save picture to album Uiimagewritetosavedphotosalbum is a function in the Uikit framework. Here's what the following three parameters mean: void Uiimagewritetosavedphotosalbum ( uiimage *image, id & nbsp completiontarget, sel completionSelector, void *contextinfo) id is the target object, and the SEL is selector, the method name on the target object, ContextInfo is an arbitrary pointer that is passed to the method defined by selector. This is usually done when the method is called when it is finished, or when the error is completed.  , use: uiimagewritetosavedphotosalbum (m_currentimage.image, nil, nil, nil);//Then you can find the image 13 you added in the album. iOS Open photo Gallery, open Camera//Open photo Gallery Uiimagepickercontroller *imagepicker = [[Uiimagepickercontroller alloc ] init]; imagepicker.delegate = self; //imagepicker.allowsimageedit ing = YES; //images can be edited //need to add a delegate [self Presentmodalviewcontroller: Imagepicker animated:yes]; [imagepicker release]; //Open Camera if ([Uiimagepickercontrolle Issourcetypeavailable:uiimagepickercontrollersourcetypecamera]) { Uiimagepickercontroller *imagepicker = [[Uiimagepickercontroller alloc] init]; I Magepicker.delegate = self; //imagepicker.allowsimageediting = yes; Imagepicker.sourcetype = UIimagepickercontrollersourcetypecamera; [self Presentmodalviewcontroller: Imagepicker animated:yes]; [Imagepicker release]; }13. The effect of Cgrectoffset is offset by the x-axis and y-axis relative to the origin of the source rectangle (the point in the upper-left corner), for example: [Self.view setframe:cgrectoffset (Self.view.frame, 260, 0)];view along (0, 0) x-axis move right 260 pixels 14. Array deep copy Nsmutablearray *arr1=[[nsmutablearray alloc] initwithobjects:@ "a", @ "B", @ "C", nil]; Nsmutablearray *arr2=[[nsmutablearray alloc] init]; ARR2=[ARR1 mutablecopy]; [ arr1 removeobject:@ "B"];//results Arr1:a,c //arr2:a,b,c 15.uitableviewcell reuse resolved when adding other controls in the cell, scrolling after repeated loading, text ghosting, Control disorder NSString *cellidentifier = [NSString stringwithformat:@ "cell%d%d", [Indexpath section], [Indexpath Row]]; UITableViewCell *cell = [TableView dequeuereusablecellwithidentifier:cellidentifier]; if (cell = = nil) {& nbsp cell = [[[UITableViewCell alloc] Initwithstyle:uitableviEwcellstyledefault Reuseidentifier:cellidentifier] autorelease];//Add code }16. Uitextview height is calculated based on text: Uifont *font = [Uifont systemfontofsize:14.0]; cgsize size = [M_textview.text Sizewithfont:font Constrainedtosize:cgsizemake (240,9999) linebreakmode:uilinebreakmodewordwrap];// Two parameters of Constrainedtosize the first parameter is the width of the TextView, the second parameter is not yet understood and the height of the TextView is modified [m_textview Setframe:cgrectmake (52 , 104, size.height+30)]; 17.viewdidload called when the view is initialized from the nib file, Loadview when the controller's view is nil. This method is called when the program implements view, and the view controller registers the memory warning notification by default, and Viewdidunload is called when any view of the view controller is useless. In this case, the retain view release will be implemented, and if it is retain's Iboutlet view property, then Release,iboutlet will not be responsible for release. The difference between 18.delegate and notification delegate for one-to-one relationships, and reciever can return values to sender;notification for One-to-one/many/none, Reciever cannot return a value to sender, so delegate is used by sender to receive a function feedback value of reciever, notification is used to notify multiple object of an event. 19. Use variable A to give the following definition a) an integer number (an integer) b) A pointer to the integer number (a pointer to an integer) c) A pointer to the pointer, which refers to theThe pointer is to a number of integers (a pointer to a pointer to an integer) d) a array of 10 integers (an array of ten integers) e) A 10 pointer to a number of integers (an A Rray of pointers to integers) f) A pointer to a 10 integer array (a pointer to an array of ten integers) g) A pointer to a function that has an integer parameter and returns an integer number (a Pointer to a function so takes an integer as an argument and returns an integer) h) A 10-pointer array that points to a function with an integer parameter and returns a Number of integers (an array of ten pointers to functions, take an integerargument and return an integer) (1) int A; An integer (2) int *a; A pointer to an integer (3) int **a; A pointer to a pointer to an integer (4) int a[10]; An array of ten integers (5) int *a[10]; An array of ten pointers to integers (6) int (*a) [10]; A pointer to an array of ten integers (7) int (*a) (int); A pointer to a function A, takes an integer argument and returns an integer (8) int (*a[10]) (int); An array of ten pointers to functions A, a integer argument and return an integer 20.nsurl conversion nsstring, Nsmut Ablearray conversion Nsarraynsurl Conversion nSstringnsurl *url= NSString *str=[url Absolutestring]; nsmutablearray Conversion Nsarray:nsmutablearray *list=···· Nsarray *list=[list mutablecopy];
Some small knowledge of iOS