欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

IOS開發(fā)之ios視頻截屏的實現(xiàn)代碼

IOS 開發(fā)之ios視頻截屏的實現(xiàn)代碼

創(chuàng)新互聯(lián)建站主營遼陽網(wǎng)站建設的網(wǎng)絡公司,主營網(wǎng)站建設方案,重慶APP軟件開發(fā),遼陽h5小程序開發(fā)搭建,遼陽網(wǎng)站營銷推廣歡迎遼陽等地區(qū)企業(yè)咨詢

           現(xiàn)在好多視頻截屏軟件,這里提供一個IOS 視頻截屏的方法,大家可以參考下,

實現(xiàn)代碼:

//截屏 
static int i=0; 
-(IBAction)screenShot:(id)sender{ 
   
  UIGraphicsBeginImageContextWithOptions(CGSizeMake(640, 960), YES, 0); 
  [[self.window layer] renderInContext:UIGraphicsGetCurrentContext()]; 
  UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); 
  UIGraphicsEndImageContext(); 
  CGImageRef imageRef = viewImage.CGImage; 
  CGRect rect =CGRectMake(166, 211, 426, 320);//這里可以設置想要截圖的區(qū)域 
  CGImageRef imageRefRect =CGImageCreateWithImageInRect(imageRef, rect); 
  UIImage *sendImage = [[UIImage alloc] initWithCGImage:imageRefRect]; 
  UIImageWriteToSavedPhotosAlbum(sendImage, nil, nil, nil);//保存圖片到照片庫 
  NSData *imageViewData = UIImagePNGRepresentation(sendImage); 
   
  NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
  NSString *documentsDirectory = [paths objectAtIndex:0]; 
  NSString *pictureName= [NSString stringWithFormat:@"screenShow_%d.png",i]; 
  NSString *savedImagePath = [documentsDirectory stringByAppendingPathComponent:pictureName]; 
  NSLog(@"%@", savedImagePath); 
  [imageViewData writeToFile:savedImagePath atomically:YES];//保存照片到沙盒目錄 
  CGImageRelease(imageRefRect); 
  i++; 
} 

感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!

網(wǎng)站題目:IOS開發(fā)之ios視頻截屏的實現(xiàn)代碼
路徑分享:http://www.chinadenli.net/article4/peihie.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供微信小程序響應式網(wǎng)站企業(yè)網(wǎng)站制作虛擬主機品牌網(wǎng)站建設手機網(wǎng)站建設

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

綿陽服務器托管