pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

      <legend id='T6VQu'><style id='T6VQu'><dir id='T6VQu'><q id='T6VQu'></q></dir></style></legend>

      1. <small id='T6VQu'></small><noframes id='T6VQu'>

          <bdo id='T6VQu'></bdo><ul id='T6VQu'></ul>

        <tfoot id='T6VQu'></tfoot>
        <i id='T6VQu'><tr id='T6VQu'><dt id='T6VQu'><q id='T6VQu'><span id='T6VQu'><b id='T6VQu'><form id='T6VQu'><ins id='T6VQu'></ins><ul id='T6VQu'></ul><sub id='T6VQu'></sub></form><legend id='T6VQu'></legend><bdo id='T6VQu'><pre id='T6VQu'><center id='T6VQu'></center></pre></bdo></b><th id='T6VQu'></th></span></q></dt></tr></i><div class="dpnbpt7" id='T6VQu'><tfoot id='T6VQu'></tfoot><dl id='T6VQu'><fieldset id='T6VQu'></fieldset></dl></div>
      2. 如何顯示 NSDocument 目錄中的所有圖像

        How to display all images from NSDocument directory(如何顯示 NSDocument 目錄中的所有圖像)

            <tbody id='B2e3c'></tbody>
          <tfoot id='B2e3c'></tfoot>

          <small id='B2e3c'></small><noframes id='B2e3c'>

            • <bdo id='B2e3c'></bdo><ul id='B2e3c'></ul>
              <legend id='B2e3c'><style id='B2e3c'><dir id='B2e3c'><q id='B2e3c'></q></dir></style></legend>
                1. <i id='B2e3c'><tr id='B2e3c'><dt id='B2e3c'><q id='B2e3c'><span id='B2e3c'><b id='B2e3c'><form id='B2e3c'><ins id='B2e3c'></ins><ul id='B2e3c'></ul><sub id='B2e3c'></sub></form><legend id='B2e3c'></legend><bdo id='B2e3c'><pre id='B2e3c'><center id='B2e3c'></center></pre></bdo></b><th id='B2e3c'></th></span></q></dt></tr></i><div class="q0gcu00" id='B2e3c'><tfoot id='B2e3c'></tfoot><dl id='B2e3c'><fieldset id='B2e3c'></fieldset></dl></div>

                2. 本文介紹了如何顯示 NSDocument 目錄中的所有圖像的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  首先我從照片庫中選擇圖像到 ALAsset 庫,然后我將圖像從 ALAsset 庫路徑存儲在文檔目錄中.

                  First i selected images from photo library to ALAsset Library and after that i stored images in document directory from ALAsset library path.

                  我正在使用此代碼將圖像存儲在 ALAsset 庫中的文檔目錄中......它的工作完美......現在我想在表格視圖中顯示存儲在文檔目錄中的所有圖像......我該怎么做???誰能幫幫我??

                  i am using this code to store images in document directory from ALAsset Library.... Its working perfect... Now i want to display all images which are stored in document directory in table view.. how can i do this??? can anybody help me??

                  將圖像從 ALAsset 庫導入到 NSdocument 目錄的代碼

                  for (int j=0; j<[assetArray count]; j++) {
                  
                  ALAssetRepresentation *representation = [[assetArray objectAtIndex:j] defaultRepresentation];
                  NSString* filename = [documentPath stringByAppendingPathComponent:[representation filename]];
                  
                  [[NSFileManager defaultManager] createFileAtPath:filename contents:nil attributes:nil];
                  NSOutputStream *outPutStream = [NSOutputStream outputStreamToFileAtPath:filename append:YES];
                  [outPutStream open];
                  
                  long long offset = 0;
                  long long bytesRead = 0;
                  
                  NSError *error;
                  uint8_t * buffer = malloc(131072);
                  while (offset<[representation size] && [outPutStream hasSpaceAvailable]) {
                      bytesRead = [representation getBytes:buffer fromOffset:offset length:131072 error:&error];
                      [outPutStream write:buffer maxLength:bytesRead];
                      offset = offset+bytesRead;
                  }
                  [outPutStream close];
                  free(buffer);
                  

                  }

                  之后我使用此代碼獲取目錄的內容:

                  After that i got the contents of directory using this code:

                   NSFileManager *manager = [NSFileManager defaultManager];
                  fileList = [manager directoryContentsAtPath:newDir];
                  

                  它也可以工作...但是現在當我想顯示文檔目錄中的圖像時.它沒有顯示任何東西......

                  Its also working... but now when i want to display images from document directory. It doesn't show anything....

                   setImage.image=[UIImage imageNamed:[filePathsArray objectAtIndex:0]];
                  

                  誰能幫忙,問題出在哪里??????- 我有一個疑問:*將圖像從ALAsset庫導入到文檔目錄是否正確???

                  Can anybody help, where is the problem????? - I have one doubt: *Is it the right way to import images from ALAsset Library to document directory???

                  推薦答案

                  這個答案是關于如何從文檔目錄中檢索圖像并將它們顯示到 UITableView.....

                  首先,您必須將文檔目錄中的所有圖像保存到一個數組中......

                  first of all you have to get all images from your documents directory to an array....

                  -(void)viewWillAppear:(BOOL)animated
                  {
                  
                      arrayOfImages = [[NSMutableArray alloc]init];
                  NSError *error = nil;
                  
                  
                      NSString *stringPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)objectAtIndex:0];
                  
                      NSArray *filePathsArray = [[NSFileManager defaultManager] subpathsOfDirectoryAtPath: stringPath ?error:&error];
                  
                    for(int i=0;i<[filePathsArray count];i++)
                    {
                        NSString *strFilePath = [filePathsArray objectAtIndex:i];
                        if ([[strFilePath pathExtension] isEqualToString:@"jpg"] || [[strFilePath pathExtension] isEqualToString:@"png"] || [[strFilePath pathExtension] isEqualToString:@"PNG"]) 
                        {
                           NSString *imagePath = [[stringPath stringByAppendingString:@"/"] stringByAppendingString:strFilePath];
                           NSData *data = [NSData dataWithContentsOfFile:imagePath];
                          if(data)
                          {
                            UIImage *image = [UIImage imageWithData:data];
                            [arrayOfImages addObject:image];
                          }
                        }
                  
                    }
                  
                  }
                  

                  之后 - 使用此數組,您可以在 uitableview 單元格中顯示圖像記住不要在你的視圖上添加表格視圖,直到你的數組被填滿.....

                  after that - using this array you can show the image in uitableview cell remember dont add the table view on your view untill your array is fill.....

                  #pragma mark - UItableViewDelegate methods
                  -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
                  {
                      return 1;
                  }
                  
                  -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
                  {
                      return [arrayOfImages count];
                  }
                  
                  -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
                  {
                  
                      static NSString *CellIdentifier = @"Cell";
                      UITableViewCell *cell = [tablView dequeueReusableCellWithIdentifier:CellIdentifier];
                      if(cell == nil)
                      {
                          cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
                      }
                      //adjust your imageview frame according to you
                      UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0.0, 0.0, 470.0, 80.0)];
                  
                      [imageView setImage:[arrayOfImages objectAtIndex:indexPath.row]];
                      [cell.contentView addSubview:imageView];
                      return cell;
                  

                  }

                  現在運行它會工作..

                  這篇關于如何顯示 NSDocument 目錄中的所有圖像的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to animate a UIImageview to display fullscreen by tapping on it?(如何通過點擊動畫 UIImageview 以顯示全屏?)
                  To stop segue and show alert(停止 segue 并顯示警報)
                  iOS 5 storyboard, programmatically determine path(iOS 5 故事板,以編程方式確定路徑)
                  Icon already includes gloss effects(圖標已經包含光澤效果)
                  How does UIEdgeInsetsMake work?(UIEdgeInsetsMake 是如何工作的?)
                  UIProgressView and Custom Track and Progress Images (iOS 5 properties)(UIProgressView 和自定義跟蹤和進度圖像(iOS 5 屬性))

                  1. <small id='nfRLw'></small><noframes id='nfRLw'>

                      <bdo id='nfRLw'></bdo><ul id='nfRLw'></ul>

                          <tbody id='nfRLw'></tbody>

                      • <legend id='nfRLw'><style id='nfRLw'><dir id='nfRLw'><q id='nfRLw'></q></dir></style></legend>

                        • <i id='nfRLw'><tr id='nfRLw'><dt id='nfRLw'><q id='nfRLw'><span id='nfRLw'><b id='nfRLw'><form id='nfRLw'><ins id='nfRLw'></ins><ul id='nfRLw'></ul><sub id='nfRLw'></sub></form><legend id='nfRLw'></legend><bdo id='nfRLw'><pre id='nfRLw'><center id='nfRLw'></center></pre></bdo></b><th id='nfRLw'></th></span></q></dt></tr></i><div class="uumyguo" id='nfRLw'><tfoot id='nfRLw'></tfoot><dl id='nfRLw'><fieldset id='nfRLw'></fieldset></dl></div>
                          1. <tfoot id='nfRLw'></tfoot>
                            主站蜘蛛池模板: 土壤养分检测仪_肥料养分检测仪_土壤水分检测仪-山东莱恩德仪器 大型多片锯,圆木多片锯,方木多片锯,板材多片锯-祥富机械有限公司 | 祝融环境-地源热泵多恒系统高新技术企业,舒适生活环境缔造者! | 自恢复保险丝_贴片保险丝_力特保险丝_Littelfuse_可恢复保险丝供应商-秦晋电子 | 【德信自动化】点胶机_全自动点胶机_自动点胶机厂家_塑料热压机_自动螺丝机-深圳市德信自动化设备有限公司 | 北京开源多邦科技发展有限公司官网 | vr安全体验馆|交通安全|工地安全|禁毒|消防|安全教育体验馆|安全体验教室-贝森德(深圳)科技 | Copeland/谷轮压缩机,谷轮半封闭压缩机,谷轮涡旋压缩机,型号规格,技术参数,尺寸图片,价格经销商 CTP磁天平|小电容测量仪|阴阳极极化_双液系沸点测定仪|dsj电渗实验装置-南京桑力电子设备厂 | 对夹式止回阀_对夹式蝶形止回阀_对夹式软密封止回阀_超薄型止回阀_不锈钢底阀-温州上炬阀门科技有限公司 | 合肥角钢_合肥槽钢_安徽镀锌管厂家-昆瑟商贸有限公司 | 西门子伺服电机维修,西门子电源模块维修,西门子驱动模块维修-上海渠利 | 印刷人才网 印刷、包装、造纸,中国80%的印刷企业人才招聘选印刷人才网! | 知名电动蝶阀,电动球阀,气动蝶阀,气动球阀生产厂家|价格透明-【固菲阀门官网】 | Maneurop/美优乐压缩机,活塞压缩机,型号规格,技术参数,尺寸图片,价格经销商 | 民用音响-拉杆音响-家用音响-ktv专用音响-万昌科技 | 泰来华顿液氮罐,美国MVE液氮罐,自增压液氮罐,定制液氮生物容器,进口杜瓦瓶-上海京灿精密机械有限公司 | 标准品网_标准品信息网_【中检计量】| 深圳市源和塑胶电子有限公司-首页 | 对夹式止回阀_对夹式蝶形止回阀_对夹式软密封止回阀_超薄型止回阀_不锈钢底阀-温州上炬阀门科技有限公司 | 报警器_家用防盗报警器_烟雾报警器_燃气报警器_防盗报警系统厂家-深圳市刻锐智能科技有限公司 | 免费B2B信息推广发布平台 - 推发网| 粘度计,数显粘度计,指针旋转粘度计| 智能终端_RTU_dcm_北斗星空自动化科技 | elisa试剂盒-PCR试剂盒「上海谷研实业有限公司」 | 27PR跨境电商导航 | 专注外贸跨境电商 | 权威废金属|废塑料|废纸|废铜|废钢价格|再生资源回收行情报价中心-中废网 | 货车视频监控,油管家,货车油管家-淄博世纪锐行电子科技 | 废气处理设备-工业除尘器-RTO-RCO-蓄热式焚烧炉厂家-江苏天达环保设备有限公司 | 影像测量仪_三坐标测量机_一键式二次元_全自动影像测量仪-广东妙机精密科技股份有限公司 | 挤出熔体泵_高温熔体泵_熔体出料泵_郑州海科熔体泵有限公司 | 净化车间_洁净厂房_净化公司_净化厂房_无尘室工程_洁净工程装修|改造|施工-深圳净化公司 | 台式低速离心机-脱泡离心机-菌种摇床-常州市万丰仪器制造有限公司 | 机房监控|动环监控|动力环境监控系统方案产品定制厂家 - 迈世OMARA | 在线钠离子分析仪-硅酸根离子浓度测定仪-油液水分测定仪价格-北京时代新维测控设备有限公司 | 交通信号灯生产厂家_红绿灯厂家_电子警察监控杆_标志杆厂家-沃霖电子科技 | 新车测评网_网罗汽车评测资讯_汽车评测门户报道 | 橡胶粉碎机_橡胶磨粉机_轮胎粉碎机_轮胎磨粉机-河南鼎聚重工机械制造有限公司 | 外贸网站建设-外贸网站设计制作开发公司-外贸独立站建设【企术】 | 手术室净化装修-手术室净化工程公司-华锐手术室净化厂家 | 建筑消防设施检测系统检测箱-电梯**检测仪器箱-北京宇成伟业科技有限责任公司 | 氢氧化钾厂家直销批发-济南金昊化工有限公司 | 防爆鼓风机-全风-宏丰鼓风机-上海梁瑾机电设备有限公司 |