demo功能:一个不错的图片浏览分享框架demo。iphone6.1 测试通过。可以浏览图片,保存,微博分享到新浪,腾讯,网易,人人等。
注:(由于各个微博的接口有时候会有调整,不一定能分享成功。只看框架,在找最新的官方分享接口将信息分享出去)
demo说明:主要代码在:PhotoViewController.m中。分享的各个接口在ShareSDK文件夹下。
框架用到了“SVProgressHUD” 第三方的控件来弹出提示层,提示 网络加载 或 提示对错。SVProgressHUD的具体说明;
和 “SDWebImage”类库来管理远程图片加载。SDWebImage的相关说明;
demo截屏:
demo主要代码: 主窗口布局部分
- (void)viewDidLoad { [super viewDidLoad]; self.navigationItem.title = dNaviTitle; self.navigationController.navigationBar.tintColor = [UIColor blackColor]; self.navigationController.navigationBarHidden = YES; self.navigationController.navigationBar.translucent = YES; [[UIApplication sharedApplication] setStatusBarHidden:YES]; [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent]; //self.navigationController.navigationBar.alpha = 0.5f;//将透明度设为50%。 UIBarButtonItem *spaceItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil]; UIBarButtonItem *saveBarBtn = [[UIBarButtonItem alloc] initWithImage:dPicModuleImageSave style:UIBarButtonItemStylePlain target:self action:@selector(saveImage)]; UIBarButtonItem *spaceFlexItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:self action:nil]; spaceFlexItem.width = 20.0; //分享按钮 UIBarButtonItem *shareBarBtn = [[UIBarButtonItem alloc] initWithImage:dPicToolShare style:UIBarButtonItemStylePlain target:self action:@selector(shareImage)]; NSArray *barBtnArray = [NSArray arrayWithObjects:spaceItem, saveBarBtn, spaceFlexItem, shareBarBtn, nil]; [self setToolbarItems:barBtnArray]; self.navigationController.toolbar.tintColor = [UIColor blackColor]; self.navigationController.toolbar.translucent = YES; self.navigationController.toolbarHidden = YES; [self setWantsFullScreenLayout:YES]; //图片数组 _imageURLArray = [[NSMutableArray alloc]initWithObjects: @"http://jpp1.imghb.com/pic/pic/69/90/24/1410827669902478_a602x602.jpg", @"http://jpp1.imghb.com/pic/pic/62/21/20/1396500062212039_a602x602.jpg", @"http://jpp1.imghb.com/pic/pic/87/42/85/1405532187428506_a602x602.jpg", @"http://jpp1.imghb.com/pic/pic/99/43/0/1392392199430020_a602x602.jpg", @"http://jpp2.imghb.com/pic/pic/45/48/1/1399381845480110_a602x602.jpg", @"http://jpp2.imghb.com/pic/pic/49/50/84/1407448049508416_a602x602.jpg", @"http://jpp2.imghb.com/pic/pic/88/82/83/1402371388828392_a602x602.jpg", @"http://jpp2.imghb.com/pic/pic/94/37/71/1401133494377186_a602x602.jpg", @"http://jpp2.imghb.com/pic/pic/88/35/25/1401128288352593_a602x602.jpg", nil]; _scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)]; [_scrollView setContentSize:CGSizeMake(320*[_imageURLArray count], 480)]; if ([UIScreen mainScreen].bounds.size.height >= 568)//iPhone5适配 { _scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, 320, 568)]; [_scrollView setContentSize:CGSizeMake(320*[_imageURLArray count], 568)]; } _scrollView.pagingEnabled = YES;//设为YES时,会按页滑动 _scrollView.bounces = NO;//取消UIScrollView的弹性属性,这个可以按个人喜好来定 [_scrollView setDelegate:self];//UIScrollView的delegate函数在本类中定义 _scrollView.showsHorizontalScrollIndicator = YES; _scrollView.minimumZoomScale=0.1; _scrollView.maximumZoomScale=4.0; [self.view addSubview:_scrollView]; [self configScrowViewWithIndex:self.itemIndex withForward:NO withOrigin:YES]; pageIndex = itemIndex; _isBarShown = NO; }
demo下载地址: http://download.csdn.net/download/donny_zhang/5693359