// 判断是否加载过新手指南
NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
BOOL isADD = [user objectForKey:@"secondCouponBoard_iPhone"];
if (isADD != YES) {
[self newUserGuide];
}
#pragma mark - ===== 新手指引 =====
/**
* 新手指引
*/
- (void)newUserGuide
{
// 这里创建指引在这个视图在window上
CGRect frame = [UIScreen mainScreen].bounds;
// 把背景view添加到window上边
UIView * bgView = [[UIView alloc] initWithFrame:frame];
[bgView setBackgroundColor:[UIColor clearColor]];
[[UIApplication sharedApplication].keyWindow addSubview:bgView];
// 添加背景图片 并在背景图片上边添加轨迹
UIImageView * bgImg = [[UIImageView alloc] initWithFrame:frame];
[bgImg setBackgroundColor:[UIColor blackColor]];
bgImg.alpha = 0.6;
[bgView addSubview:bgImg];
//create path 重点来了(**这里需要添加第一个路径)
UIBezierPath *path = [UIBezierPath bezierPathWithRect:frame];
// 这里添加第二个路径 (这个是圆)
[path appendPath:[[UIBezierPath bezierPathWithRoundedRect:CGRectMake(13, 33, kWidth - 13* 2, 94) cornerRadius:5] bezierPathByReversingPath]];
CAShapeLayer *shapeLayer = [CAShapeLayer layer];
shapeLayer.path = path.CGPath;
[bgImg.layer setMask: shapeLayer];
// 添加指引图片
UIImageView * img = [[UIImageView alloc] init];
[img setFrame:CGRectMake((kWidth - 290) /2, 100, 290, 180)];
[img setImage:[UIImage imageNamed:@"guide_04"]];
[img setContentMode:UIViewContentModeScaleToFill];
[bgView addSubview:img];
// 添加点击事件
UIButton * newGuidBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[newGuidBtn setFrame:frame];
[newGuidBtn addTarget:self action:@selector(clickBtnToGuid:) forControlEvents:UIControlEventTouchUpInside];
[bgView addSubview:newGuidBtn];
}
- (void)clickBtnToGuid:(UIButton *)sender
{
// 点击之后移除到父类view
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"secondCouponBoard_iPhone"];
[sender.superview removeFromSuperview];
}
IOS APP新手指南
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 作者:天下雪 来源地址:http://www.wxapp-union.com/forum.php?mod...
- App迁移(App transfer):将App从一个开发者账号迁移至另一个开发者账号。此文演示了整个迁移过程,为...
- 1、在appdelegate.m中找到 “application:didFinishLaunchingWithOp...
- 我在美拍上开了直播,准备把它做成一档节目,叫生活领队,24小时永不间断的直播我的生活。 我去年在大理呆了大半年,其...