ios假设写一个提示带动画的View,能够来引导用户行为
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了ios假设写一个提示带动画的View,能够来引导用户行为,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1825字,纯文字阅读大概需要3分钟。
内容图文
先上图:
这个UIView能够这样写:
-(id)initWithFrame:(CGRect)frame backImage:(UIImage*)image msgStr:(NSString*)txt txtColor:(UIColor*)color{ self = [super initWithFrame:frame]; if (self) { self.backgroundColor = [UIColor clearColor]; _paopaoImage = image; _txt = txt; _color = color; } return self; } // Only override drawRect: if you perform custom drawing. // An empty implementation adversely affects performance during animation. - (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); CGRect textRc = rect; [_paopaoImage drawInRect:rect]; CGFontRef contextFont = CGFontCreateWithFontName((CFStringRef)[UIFont systemFontOfSize:14].fontName); CFRelease(contextFont); CGContextSetFontSize(context, 14.0); CGContextSetFillColorWithColor(context, _color.CGColor); textRc.origin.y += 11.0f; [_txt drawInRect:textRc withFont:[UIFont systemFontOfSize:14] lineBreakMode:NSLineBreakByWordWrapping alignment:NSTextAlignmentCenter]; }
然后弹出的时候:
-(void)showTipView{ CGRect rect = [[HomePageUIManager sharedInstance] categoryTipViewFrameWhenLaunch]; PopUpMenu* menu = [[PopUpMenu alloc] initWithFrame:rect backImage:[UIImage imageNamed:@"change_search_tip.png"] msgStr:@"打开/关闭面板" txtColor:[CCommon RGBColorFromHexString:@"#ffffff" alpha:1.0f]]; [self.view addSubview:menu]; CABasicAnimation *jumpAnimation = [CABasicAnimation animationWithKeyPath:@"transform.translation.y"]; jumpAnimation.fromValue = [NSNumber numberWithFloat:0.0f]; jumpAnimation.toValue = [NSNumber numberWithFloat:8.0f]; jumpAnimation.duration = 0.5f;//动画持续时间 jumpAnimation.repeatCount = 10;//动画反复次数 jumpAnimation.autoreverses = YES;//是否自己主动反复 [menu.layer addAnimation:jumpAnimation forKey:@"animateLayer"]; }
代码能够在http://download.csdn.net/detail/baidu_nod/7629687下载
原文:http://www.cnblogs.com/yutingliuyl/p/6900803.html
内容总结
以上是互联网集市为您收集整理的ios假设写一个提示带动画的View,能够来引导用户行为全部内容,希望文章能够帮你解决ios假设写一个提示带动画的View,能够来引导用户行为所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。
来源:【匿名】