1.文字、按钮在聚光灯上面(默认在聚光灯下面)
NSArray *coachMarks = @[
@{@"rect": [NSValue valueWithCGRect:(CGRect){{SCREEN_WIDTH/8.0*5-25,SCREEN_HEIGHT-HeightOfTabBar},{50,50.0f}}], @"caption": @"",@"bottomImage":@"我知道了",@"midleImage":@"文字提示-首页",@"positionCaption": @"1"},
];
[self creatSpotlightView:FistHomeSpotlight withArray:coachMarks withSuprView:[UIApplication sharedApplication].keyWindow];
2.在UIViewController中写分类
//聚光灯
- (void)creatSpotlightView:(NSString *)keyString withArray:(NSArray *)coachMarks withSuprView:(UIView *)suprView{
if (![[NSUserDefaults standardUserDefaults] boolForKey:keyString]) {
WSCoachMarksView *coachMarksView = [[WSCoachMarksView alloc] initWithFrame:(CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)) coachMarks:coachMarks];
[suprView addSubview:coachMarksView];
coachMarksView.delegate = self;
[coachMarksView start];
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:keyString];
}
}
3.效果如图所示
Simulator Screen Shot - iPhone 11 Pro Max - 2020-04-22 at 13.58.11.png
网友评论