先上图:

这个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下载

ios假设写一个提示带动画的View,能够来引导用户行为的更多相关文章

  1. iOS 开发自定义一个提示框

    在开发的时候,会碰到很多需要提示的地方,提示的方法也有很多种,ios 8 以前的版本有alertview还是以后用的alertController,都是这种作用, 但是不够灵活,而且用的多了,用户体验 ...

  2. 如何用PHP/MySQL为 iOS App 写一个简单的web服务器(译) PART1

    原文:http://www.raywenderlich.com/2941/how-to-write-a-simple-phpmysql-web-service-for-an-ios-app 作为一个i ...

  3. 假设写一个android桌面滑动切换屏幕的控件(一)

    首先这个控件应该是继承ViewGroup: 初始化: public class MyGroup extends ViewGroup{ private Scroller mScroller; priva ...

  4. iOS重写drawRect方法实现带箭头的View

    创建一个UIView的子类,重写drawRect方法可以实现不规则形状的View,这里提供一个带箭头View的实现代码: ArrowView.h #import <UIKit/UIKit.h&g ...

  5. 【Android】 给我一个Path,还你一个酷炫动画

    本篇文章已授权微信公众号 hongyangAndroid (鸿洋)独家公布 转载请标明出处: http://blog.csdn.net/zxt0601/article/details/53040506 ...

  6. [iOS UI进阶 - 6.3] UIView 动画

    1.UIView转场过渡动画   // // ViewController.m // UIViewAnimationTest // // Created by hellovoidworld on 15 ...

  7. android标题栏下面弹出提示框(一) TextView实现,带动画效果

    产品经理用的是ios手机,于是android就走上了模仿的道路.做这个东西也走了一些弯路,写一篇博客放在这里,以后自己也可用参考,也方便别人学习. 弯路: 1.刚开始本来用PopupWindow去实现 ...

  8. android标题栏上面弹出提示框(二) PopupWindow实现,带动画效果

    需求:上次用TextView写了一个从标题栏下面弹出的提示框.android标题栏下面弹出提示框(一) TextView实现,带动画效果,  总在找事情做的产品经理又提出了奇葩的需求.之前在通知栏显示 ...

  9. iOS带动画的环形进度条(进度条和数字同步)

    本篇写的是实现环形进度条,并带动画效果,要实现这些,仅能通过自己画一个 方法直接看代码 为了方便多次调用,用继承UIView的方式 .m文件 #import <UIKit/UIKit.h> ...

随机推荐

  1. Python关于super()函数的理解

    看下面的例子: class A: def __init__(self, name): self.name = name def bb(self): print('没事就爱瞎BB') class B(A ...

  2. JavaScript——视频插入

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  3. VHDL之Aggregate

    Definition A basic operation that combines one or more values into a composite value of a record or ...

  4. 相似图像识别检 —基于图像签名(LSH)

    原文链接:http://grunt1223.iteye.com/blog/828192 参考:人工智能,一种现代方法 第 617页,且原始论文给出了完整的证明过程.在ANN方法中,LSH算一种可靠的紧 ...

  5. 杭电1003 Max Sum 【连续子序列求最大和】

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1003 题目意思: 即给出一串数据,求连续的子序列的最大和 解题思路: 因为我们很容易想到用一个max ...

  6. Selenium3+python自动化008-常用操作

    一.元素常用操作 1. clear()            清除文本 2. send_keys()        模拟输入 3. click()            单击元素 4.get_attr ...

  7. js商城倒计时

    js将秒转换为几天几小时几分钟 1 var oldsecond=second = 60,minute=0,hour=0,day=0; minute = parseInt(second/60); //算 ...

  8. 搭建`wenblogic`执行`install`脚本失败

    搭建weblogic服务,前期准备都已经完成,安装包都是已上传,执行install_wls1213.sh脚本,出现以下报错: install_wls1213.sh: line 1: rectory: ...

  9. Project Euler 44 Sub-string divisibility( 二分 )

    题意:五边形数由公式Pn=n(3n−1)/2生成,在所有和差均为五边形数的五边形数对Pj和Pk中,找出使D = |Pk − Pj|最小的一对:此时D的值是多少? 思路:二分找和差 /********* ...

  10. 3.1、Jinja2模板引擎

    形式最简单的 Jinja2 模板就是一个包含响应文本的文件.示例 3-1 是一个 Jinja2 模板,它和示例 2-1 中 index() 视图函数的响应一样. 示例 3-1 templates/in ...