先上图:

这个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. 2017-3-12 leetcode 167 209 216

    ---恢复内容开始--- 对于每次开机avast喊出的“已经检测到危害”实在忍无可忍了(它只能检测到不能根除很气..)于是重装了系统,回到了win10感觉不赖. =================== ...

  2. bind(),call(), apply()方法的区别是什么?

    bind(),call(), apply()方法的区别是什么? 共同点:改变this指向,任何调用都不在起作用 bind() 改变this的指向,不会调用函数,返回一个新的函数 var o ={a:' ...

  3. ubuntu刚安装好之后apt-get使用异常

    gaozhang 刚安装好之后,想执行apt-get update 任务,出现以下错误提示   提示说明apt正在执行,我们就野蛮的将apt进程杀.死即可,不过有点多,一个个kill   执行完之后再 ...

  4. linux+nginx+python+django环境配置

    Django是一个开放源代码的Web应用框架,由Python写成,它最初是被开发来用于管理劳伦斯出版集团旗下的一些以新闻内容为主的网站的.python+django也是web开发者最受欢迎的框架.今天 ...

  5. php生成唯一识别码uuid

    /*生成唯一标志*标准的UUID格式为:xxxxxxxx-xxxx-xxxx-xxxxxx-xxxxxxxxxx(8-4-4-4-12)*/ function uuid() { $chars = md ...

  6. Jquery插件:提示框

    在实际项目中,很容易有这种需求:当某个操作成功或失败,需要给用户一个提示.当然最简单的做法是调用alert()方法弹窗.但alert()属于JavaScript中BOM部分,每个浏览器的样式不太一样, ...

  7. 洛谷P1466 集合 Subset Sums_01背包水题

    不多解释,适当刷刷水… Code: #include<cstdio> #include<algorithm> using namespace std; const int ma ...

  8. background及background-size

    background有以下几种属性: background-color background-position background-size background-repeat background ...

  9. 网络教程(12) TCP协议

    IP协议的限制 IP协议需要 datalink帧来包装它 Ethernet或者PPP 一般都有1500byte字节或者大小的限制 可能会出现的问题 Packet loss – retransmit R ...

  10. 网络教程(10)回顾ARP和ping数据包

    Ping 192.168.20.2 ICMP Echo (Internet Control Message Protocol ICMP Echo request ICMP Echo reply 收到I ...