iOS开发(OC)——图片浏览器(本地图片和网络图片都可以用)

iOS开发交流群:301058503
Demo地址:https://github.com/liumude/PictureScan.git
使用(具体请看Demo)

PictureSacnViewController *picVC=[PictureSacnViewController new];
    NSMutableArray *array=[NSMutableArray array];
    for(int i=0;i<8;i++){
        NSMutableDictionary *dic=[NSMutableDictionary dictionary];
        //数据处理
        if(i!=7){//本地图片
        [dic setObject:@"1" forKey:@"islocal"];
        [dic setObject:[NSString stringWithFormat:@"%d",i+1] forKey:@"text"];
        [dic setObject:[UIImage imageNamed:[NSString stringWithFormat:@"%d",i+1]] forKey:@"picString"];
    }else{//网络图片(如果崩溃,可能是此图片地址不存在了)
        [dic setObject:@"0" forKey:@"islocal"];
        [dic setObject:@"8" forKey:@"text"];
        [dic setObject:@"http://www.apoints.com/graphics/UploadFiles/200803/20080301202754140.jpg" forKey:@"picString"];
    }
        [array addObject:dic];
    }
    picVC.picArray=[NSMutableArray arrayWithArray:array];
    picVC.currenpage=7;//当前图片
    [self.navigationController presentViewController:picVC animated:YES completion:nil];

你可能感兴趣的:(OC)