IOS开发基础知识--碎片29
1:心跳效果,并可去除心跳
- (void)initScaleLayer
{
self.view.backgroundColor=[UIColor blueColor];
UIButton *myTelButtom=[[UIButton alloc]initWithFrame: CGRectMake(, , , )];
UIImage *btnTelImage=[UIImage imageNamed:@"customer_tel_icon"];
[myTelButtom setBackgroundImage:btnTelImage forState:UIControlStateNormal];
[myTelButtom setBackgroundImage:[UIImage imageNamed:@"customer_tel_icon"] forState:UIControlStateHighlighted];
[myTelButtom addTarget:self action:@selector(btnSave:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:myTelButtom]; //设定剧本
CABasicAnimation *scaleAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
scaleAnimation.fromValue = [NSNumber numberWithFloat:1.0];
scaleAnimation.toValue = [NSNumber numberWithFloat:1.2];
scaleAnimation.autoreverses = YES;
scaleAnimation.fillMode = kCAFillModeForwards;
scaleAnimation.repeatCount = MAXFLOAT;
scaleAnimation.duration = 0.8; //开演
[myTelButtom.layer addAnimation:scaleAnimation forKey:@"scaleAnimation"];
} -(void)btnSave:(id)sender
{
UIButton *btn=(UIButton *)sender;
[btn.layer removeAnimationForKey:@"scaleAnimation"]; }
2:启动动画效果实现
原理:启动页同样是放一张静态图,只是在启动时再创建一个图片视图把一张跟启动页的图片做动画;如下:
@interface AppDelegate () @property (strong,nonatomic) UIImageView *niceView; @end @implementation AppDelegate @synthesize niceView; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window.rootViewController = [[ViewController alloc]init];;
[self.window makeKeyAndVisible]; //圖片擴大淡出的效果开始; //设置一个图片;
niceView = [[UIImageView alloc] initWithFrame:[UIScreen mainScreen].bounds];
niceView.tag=;
niceView.image = [UIImage imageNamed:@"launch4.7.png"]; //添加到场景
[self.window addSubview:niceView]; //放到最顶层;
[self.window bringSubviewToFront:niceView]; CABasicAnimation *animation=[CABasicAnimation animationWithKeyPath:@"transform.scale"];
niceView.layer.anchorPoint = CGPointMake(.,.);
animation.fromValue = @1.0f;
animation.toValue = @1.3f;
animation.fillMode=kCAFillModeForwards; animation.removedOnCompletion = NO; [animation setAutoreverses:NO]; //动画时间
animation.duration=0.9;
animation.delegate=self; [niceView.layer addAnimation:animation forKey:@"scale"]; //结束; return YES; } -(void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag
{
[niceView removeFromSuperview]; }
3:计算标签的宽度并计算是否换行显示
-(void)creatUI:(NSMutableArray *)tagArr{ self.tagArr = [NSMutableArray arrayWithArray:[tagArr mutableCopy]]; if (self.is_can_addTag) {//如果可以添加标签,那么数组就多一个添加标签按钮
[self.tagArr addObject:self.addTagStr.length>?self.addTagStr:@"添加标签"];
}
tagView_height = ; self.backgroundColor = self.tagViewBackgroundColor?self.tagViewBackgroundColor:[UIColor whiteColor]; previousFrame = CGRectZero; [self.tagArr enumerateObjectsUsingBlock:^(id value, NSUInteger idx, BOOL *stop) { //Tag标题(看传入的是字典还是字符串)
NSMutableString *titleStr = [NSMutableString stringWithString:self.tagStateType==?@" ":@""];
if ([value isKindOfClass:[NSString class]]) {
[titleStr appendString:value];
}else if([value isKindOfClass:[NSDictionary class]]){
if (!self.tagArrkey) {
//获取不到Value,因为没传入Key
NSLog(@"获取不到Value,因为没传入Key");
return ;
}
[titleStr appendString:[value valueForKey:self.tagArrkey]];
} //创建Label
UILabel*tagLabel = [[UILabel alloc]initWithFrame:CGRectZero];
[self creatTagUI:tagLabel];
tagLabel.text = titleStr;
tagLabel.tag = KTapLabelTag+idx; //计算label的大小
NSDictionary *attrs = @{NSFontAttributeName : [UIFont systemFontOfSize:self.tagFont?self.tagFont:KTagFont]};
CGSize Size_str = [titleStr sizeWithAttributes:attrs];
Size_str.width += K_Tag_Title_H_Marin*;
Size_str.height += K_Tag_Title_V_Marin*; CGRect newRect = CGRectZero; if (previousFrame.origin.x + previousFrame.size.width + Size_str.width + K_Tag_Right_Margin > JF_Screen_Width) { newRect.origin = CGPointMake(, previousFrame.origin.y + Size_str.height + K_Tag_Bottom_Margin);
tagView_height += Size_str.height + K_Tag_Bottom_Margin;
}
else {
newRect.origin = CGPointMake(previousFrame.origin.x + previousFrame.size.width + K_Tag_Right_Margin, previousFrame.origin.y); }
newRect.size = Size_str;
[tagLabel setFrame:newRect];
previousFrame=tagLabel.frame; //改变控件高度
if (idx==self.tagArr.count-) {
[self setHight:self andHight:tagView_height+Size_str.height + K_Tag_Bottom_Margin];
}
[self addSubview:tagLabel]; //新增删除、添加功能
if (self.is_can_addTag&&idx==self.tagArr.count-) {//能添加状态&&最后一个-->(进入添加tag界面不用显示删除图片) }else{
if (self.tagStateType==) {
//移除的图片
UIImageView *removeImage = [[UIImageView alloc] initWithFrame:CGRectMake(tagLabel.jf_right-Image_Width*1.5, tagLabel.jf_top+(tagLabel.jf_height-Image_Height)/, Image_Width, Image_Height)];
//删除图片可以换成自己的图片
removeImage.image = [UIImage imageNamed:@"btn_removeTag"];
[self addSubview:removeImage];
}
} //点击按钮
UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(tagLabel.frame.origin.x, tagLabel.frame.origin.y, tagLabel.frame.size.width, tagLabel.frame.size.height)];
[button setTag:KButtonTag+idx];
[button addTarget:self action:@selector(clickTag:) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:button]; }];
}
4:Fabric增加脚本KEY的操作内容
把相应的DSYM文件也上传到官网;
5:通过xcrun atos查看dsym报错的详细地址(每次打包时要把当前对应的.DSYM文件保存下来,为后期定位错误做准备)
进入到DSYM文件的文件地方,
使用xcrun atos命令
atos -o YourApp.app.dSYM/Contents/Resources/DWARF/YourApp 0x00062867
实例:
从友盟或者其它地方可以获得报错的编码,通过上面的命令就可以查看到错误地址;
IOS开发基础知识--碎片29的更多相关文章
- IOS开发基础知识碎片-导航
1:IOS开发基础知识--碎片1 a:NSString与NSInteger的互换 b:Objective-c中集合里面不能存放基础类型,比如int string float等,只能把它们转化成对象才可 ...
- IOS开发基础知识--碎片19
1:键盘事件顺序 UIKeyboardWillShowNotification // 键盘显示之前 UIKeyboardDidShowNotification // 键盘显示完成后 UIKeyboar ...
- IOS开发基础知识--碎片33
1:AFNetworking状态栏网络请求效果 直接在AppDelegate里面didFinishLaunchingWithOptions进行设置 [[AFNetworkActivityIndicat ...
- IOS开发基础知识--碎片42
1:报thread 1:exc_bad_access(code=1,address=0x70********) 闪退 这种错误通常是内存管理的问题,一般是访问了已经释放的对象导致的,可以开启僵尸对象( ...
- IOS开发基础知识--碎片50
1:Masonry 2个或2个以上的控件等间隔排序 /** * 多个控件固定间隔的等间隔排列,变化的是控件的长度或者宽度值 * * @param axisType 轴线方向 * @param fi ...
- IOS开发基础知识--碎片3
十二:判断设备 //设备名称 return [UIDevice currentDevice].name; //设备型号,只可得到是何设备,无法得到是第几代设备 return [UIDevice cur ...
- IOS开发基础知识--碎片11
1:AFNetwork判断网络状态 #import “AFNetworkActivityIndicatorManager.h" - (BOOL)application:(UIApplicat ...
- IOS开发基础知识--碎片14
1:ZIP文件压缩跟解压,使用ZipArchive 创建/添加一个zip包 ZipArchive* zipFile = [[ZipArchive alloc] init]; //次数得zipfilen ...
- IOS开发基础知识--碎片16
1:Objective-C语法之动态类型(isKindOfClass, isMemberOfClass,id) 对象在运行时获取其类型的能力称为内省.内省可以有多种方法实现. 判断对象类型 -(BOO ...
随机推荐
- MySQL学习笔记三:库和表的管理
1.MySQL数据库服务配置好后,系统会有4个默认的数据库. information_schema:虚拟对象,其对象都保存在内存中 performance_schema:服务器性能指标库 mysql: ...
- 精确率与召回率,RoC曲线与PR曲线
在机器学习的算法评估中,尤其是分类算法评估中,我们经常听到精确率(precision)与召回率(recall),RoC曲线与PR曲线这些概念,那这些概念到底有什么用处呢? 首先,我们需要搞清楚几个拗口 ...
- C语言之通过冒泡排序浅谈编程思想
写这篇博文的目的是想起到抛砖引玉的作用,还请大牛们留下一些先进的思想,让小菜学习一下.下面入正题. 复习C语言怎么能少的了冒泡呢,记得刚学C语言那会,感觉冒泡排序真的太复杂了,理解不大了,嗯!还是当时 ...
- preg_match的isU代表什么意义
正则后面的/(.*)/isU ,“isU”参数代表什么意思?这是正则中的修正符.i是同时查找大小写字母,s是圆点(.)匹配所有字符,包括换行符.如果没有设定s,则不包括换行符.U是反转了匹配数量的值 ...
- Spire.Pdf 的各种操作总结
Spire.Pdf 的各种操作总结 简介 试验新产品总是给我带来许多挑战,当然这也是一个引进创新技术的好方法.在这里我要跟大家分享的是使用Spire.Pdf的过程,它是来自E-iceblue公司的轻 ...
- 介绍一个很爽的 php 字符串特定检索函数---strpos()
大家在用 php 开发的时候 是否 有遇到过,对于一个获取的字符串,如果想要特定检测它是否 含有某个特定的字符或者子字符串,总是找不到好方法,或者根本做不到,迫于无奈而使用foreach. 函数: s ...
- 1Z0-053 争议题目解析512
1Z0-053 争议题目解析512 考试科目:1Z0-053 题库版本:V13.02 题库中原题为: 512.Which two statements correctly describe the r ...
- 1Z0-053 争议题目解析709
1Z0-053 争议题目解析709 考试科目:1Z0-053 题库版本:V13.02 题库中原题为: 709.A database has three online redo log groups w ...
- ADO.net 更新和插入数据 遇到null 执行不成功
首先交代下背景,遇到一个问题:SqlCommand新增记录时,参数为null时,运行并不报错,只是返回(0),也就是更新失败. 在用C#往数据库里面插入记录的时候, 可能有的字段我们并不赋值(有可能是 ...
- 实战 ASP.NET Web API
Web API 框架是一个面向 Http 协议的通信框架.相对于 WCF 而言,Web API 只面向于 Http 协议设计,而且没有 WCF 那么繁琐的配置.Web API 的开发类似于 ASP.N ...