@interface ViewController()
{
}
@property(nonatomic,strong)JXRollView * scrollTopView;
@end
-(void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[[NSNotificationCenter defaultCenter]postNotificationName:JXRollViewPause object:nil];
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[[NSNotificationCenter defaultCenter]postNotificationName:JXRollViewPlay object:nil];
}
- (void)viewDidLoad {
[superviewDidLoad];
_scrollTopView=[[JXRollView alloc]initWithFrame:CGRectMake(0,0,ScreenWidth,175.0/375*ScreenWidth) indicatorImageNormal:nil/*[UIImage imageNamed:@"indicatorImageNormal"]*/ indicatorImageHighlight:nil/*[UIImage imageNamed:@"indicatorImageHighlight"]*/ animateInterval:M_PI tapAction:^(NSIntegertapIndex) {
__strong__typeof(weakSelf) strongSelf = weakSelf;
[strongSelfrollViewTapIndex:tapIndex];
}];
[self.view addSubview:_scrollTopView];
NSMutableArray *arrUrls = [NSMutableArray array];
//往数组里面添加图片的URL
[arrUrls addObject:[NSURL URLWithString:model.imgurl]];
[_scrollTopView jx_refreshRollViewByUrls:arrUrls];
}
- (void)rollViewTapIndex:(NSInteger)tapIndex {
//图片点击事件的实现
}
附上guthub地址:https://github.com/augsun/JXRollView