iOS開發中常常用的代碼片斷整理

1.截圖 code

UIGraphicsBeginImageContext(myView.bounds.size);// **** 你須要截的視圖
[myView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);

2.旋轉UIImage對象 對象

UIImage *changeImage=[UIImage imageWithCGImage:oriImg.CGImage
                                             scale:1.0
                                       orientation:UIImageOrientationDown];

3.定時器當即執行 get

_sendTimer = [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(sendLog) userInfo:nil repeats:YES];
[_sendTimer setFireDate:[NSDate distantPast]]; // **** 當即執行

4.待續 it

相關文章
相關標籤/搜索