SGFocusImageView 1.0.0

SGFocusImageView 1.0.0

测试已测试
语言语言 Obj-CObjective C
许可证 BSD
发布最新发布2015 年 3 月

star 维护。



  • 作者
  • starer

LoopScrollView

LoopScrollView

要求

  • Xcode 5
  • iOS 5.0+
  • ARC

使用方法


    int length = 7;

    NSMutableArray *itemArray = [[NSMutableArray alloc] init];

    SGFocusImageItem *item_last = [[SGFocusImageItem alloc] init];
    item_last.tag = -1;
    item_last.image = @"7.png";
    [itemArray addObject:item_last];

    for (int i = 1; i < length+1; i++)
    {
        SGFocusImageItem *item = [[SGFocusImageItem alloc] init];
        item.tag = i;
        item.image = [NSString stringWithFormat:@"%d.png",i];
        item.onCurrentItemPressed = ^(SGFocusImageItem *item){

            NSLog(@"item is =>%d",item.tag);
        };

        [itemArray addObject:item];
    }

    SGFocusImageItem *item_first = [[SGFocusImageItem alloc] init];
    item_last.tag = length;
    item_first.image = @"1.png";
    [itemArray addObject:item_first];

    SGFocusImageView *bannerView = [[SGFocusImageView alloc] initWithFrame:CGRectMake(0, 20, 320, 105) imageItems:itemArray isAuto:YES];
    bannerView.focusInterval = 4.0f;
    [bannerView scrollToIndex:0];
    [self.view addSubview:bannerView];