首先需要导入自封装的三方《ImageScrollView》
#import "ViewController.h"
#import "ImageScrollView.h"
#import "AppDelegate.h"
#import "RootViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
NSArray *imgNameArr = @[@"guidePage1",@"guidePage2",@"guidePage3"];
CGRect confirmBtnFrame = CGRectMake(self.view.frame.size.width - 200, 80, 150, 40);
ImageScrollView *guide = [[ImageScrollView alloc]initWithFrame:self.view.frame style:ImageScrollType_Guide images:imgNameArr confirmBtnTitle:@"立即体验" confirmBtnTitleColor:[UIColor blueColor] confirmBtnFrame:confirmBtnFrame autoScrollTimeInterval:0 delegate:self];
//添加滚动式图
[self.view addSubview:guide];
//添加分页控件
[guide addPageControlToSuperView:self.view];
}
-(void)experienceDidHandle{
RootViewController *rootVC = [[RootViewController alloc] init];
AppDelegate *app = (AppDelegate *)[UIApplication sharedApplication].delegate;
app.window.rootViewController = rootVC;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
#import "RootViewController.h"
#import "ImageScrollView.h"
@interface RootViewController ()
@end
@implementation RootViewController
- (void)viewDidLoad {
[super viewDidLoad];
NSArray *arr = @[@"man1.jpg",@"man2.jpg",@"man3.jpg",@"man4.jpg"];
ImageScrollView *banner = [[ImageScrollView alloc] initWithFrame:CGRectMake(0, 100, self.view.frame.size.width, 350) style:ImageScrollType_Banner images:arr confirmBtnTitle:nil confirmBtnTitleColor:nil confirmBtnFrame:CGRectZero autoScrollTimeInterval:3 delegate:self];
[self.view addSubview:banner];
}
-(void)bannerImageDidHandleWithIndex:(NSInteger)index{
NSLog(@"点击了第%ld张图",index+1);
}
