1.文字矢门、按鈕在聚光燈上面(默認(rèn)在聚光燈下面)
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