Because it is a random point of knowledge, not according to a certain aspect to write.
1. About Xcode6 Simulator keyboard does not eject with Command + Shift + K
2. About calling the Clipboard copy string
+ (void) Copytextwithstr: (NSString *) str { Uipasteboard *pasteboard = [Uipasteboard Generalpasteboard]; Copy to clipboard pasteboard.string = str;}
3. Set 16 color
+ (Uicolor *) Colorwithrgbhex: (UInt32) hex {int r = (hex >>) & 0xff;int g = (hex >> 8) & 0xff;int B = (hex) & 0xff;return [Uicolor colorwithred:r/255.0f green:g/255.0fblue:b/255.0f alpha:1.0f];}
4. Print Log
#define DLOG (FMT, ...) NSLog (@ "%s [line%d]" FMT), __pretty_function__, __line__, # #__VA_ARGS__);
5. Define Window/appdelegate
#define Application ([uiapplication sharedapplication]) #define WINDOW ([[UIApplication sharedapplication].windows Lastobject])
6. Set IOS6/IOS7. The height of the navigation bar
#define NAV_H 44#define top_y (ios_7 64:nav_h) #define TOP_TABLE_VIEW_H ((ios_7? 64:nav_h) + Nav_h)
7.UIImage Cutting Circle
+ (uiimage*) Circleimage: (uiimage*) Image withparam: (cgfloat) inset withframe: (cgrect) frame{cgimageref imageref = image . Cgimage; Cgimageref resultimgref = Cgimagecreatewithimageinrect (Imageref, frame); UIImage *resultimg = [UIImage imagewithcgimage:resultimgref scale:image.scale orientation:image.imageOrientation]; Cgimagerelease (RESULTIMGREF); Uigraphicsbeginimagecontext (resultimg.size); Cgcontextref context = Uigraphicsgetcurrentcontext ();//Cgcontextsetlinewidth (context, 1);//Cgcontextsetstrokecolor Withcolor (context, [Uicolor Clearcolor]. Cgcolor); CGRect rect = CGRectMake (inset, inset, Resultimg.size.width-inset, Resultimg.size.height-inset); Cgcontextaddellipseinrect (context, rect); Cgcontextclip (context); [Resultimg Drawinrect:rect]; Cgcontextaddellipseinrect (context, rect);//Cgcontextstrokepath (context); UIImage *newimg = Uigraphicsgetimagefromcurrentimagecontext (); Uigraphicsendimagecontext (); ReTurn newimg;}
8.MD5 encryption
-(NSString *) MD5 { const char *cstr = [self utf8string]; unsigned char result[16]; CC_MD5 (CStr, (UInt32) strlen (CSTR), result); return [NSString stringWithFormat: @ "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", Result[0], result[1], result[2], result[3], result[4], result[5], result[6], result[7], result[8], result[9], RESULT[10], result[11], result[12], result[13], result[14], result[15] ];}
About iOS small points of knowledge