轮播图点击图片放大

2018-03-28  本文已影响0人  ljzza
#import "KSPhotoBrowser.h"

/** 点击图片回调 */
- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index
{
    
    NSMutableArray * imagesGroup =  [NSMutableArray arrayWithArray:cycleScrollView.imageURLStringsGroup];
    NSMutableArray * items = [NSMutableArray array];
    UIImageView * imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, cycleScrollView.width, cycleScrollView.height)];
    [imageView sd_setImageWithURL:[NSURL URLWithString:imagesGroup[index]]];
    for (int i = 0; i < imagesGroup.count; i ++)
    {
        KSPhotoItem * item = [KSPhotoItem itemWithSourceView:imageView imageUrl:[NSURL URLWithString:imagesGroup[i]]];
        [items addObject:item];
    }
    KSPhotoBrowser *browser = [KSPhotoBrowser browserWithPhotoItems:items selectedIndex:index];
    browser.dismissalStyle = KSPhotoBrowserInteractiveDismissalStyleSlide;
    browser.pageindicatorStyle = KSPhotoBrowserPageIndicatorStyleDot;
    browser.backgroundStyle = KSPhotoBrowserBackgroundStyleBlur;
    [browser showFromViewController:self];
}
上一篇 下一篇

猜你喜欢

热点阅读