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 ...
随机推荐
- 如何让ASP.NET Web API的Action方法在希望的Culture下执行
在今天编辑推荐的<Hello Web API系列教程--Web API与国际化>一文中,作者通过自定义的HttpMessageHandler的方式根据请求的Accep-Language报头 ...
- Android中实现双击事件
需求:需要给一个view实现双击效果,查看了api,发现没有api可以调用, 于是从网上参考了一段代码. xml布局文件: <RelativeLayout xmlns:android=" ...
- Android之TextView的样式类Span的使用详解
Android中的TextView是个显示文字的的UI类,在现实中的需求中,文字有各式各样的样式,TextView本身没有属性去设置实现,我们可以通过Android提供的 Spannab ...
- 数据可视化-EChart2.0.0使用中遇到的2个问题
之前项目中都是使用FusionChart和HighChart,基本都是没有购买商业许可.然后现在开发的系统需要交付给客户使用.所以现在图表控件不能直接使用FusionChart和HighChart,通 ...
- 【技巧篇】解决悬浮的<header>、<footer>遮挡内容的处理技巧
引言 在现在的前端页面中,尤其是移动端,经常会需要将<header>或者是<footer>模块悬浮出来,跟随页面的滑动保持定位在页面的最上方或者是最下方,如下图所示. “回 ...
- Sql Server函数全解(五)之系统函数
系统信息包括当前使用的数据库名称,主机名,系统错误消息以及用户名称等内容.使用SQL SERVER中的系统函数可以在需要的时候获取这些信息.下面介绍系统函数的作用和使用方法. 1.返回表中指定字段的 ...
- 用jquery实现抽奖小程序
用jquery实现抽奖小程序 这些日子,到处都可以看到关于微信小程序的新闻或报到,在博客园中写关于微信小程序的也不少.但是今天我要说的不是微信小程序,而是用简单的jquery写的一个好玩的抽奖小程序. ...
- C# 热敏打印机 Socket 网络链接 打印 图片 (二)
IPAddress ip = IPAddress.Parse("192.168.1.212"); IPEndPoint iport = );//9100为小票打印机指定端口 Soc ...
- NetCore 阿里大于发送短信
使用阿里大于API发送短信,但阿里没有提供NetCore 的API,自己看了下源码重写了发短信这个部分 public class MessageSender { private readonly st ...
- Sql数据库查询当前环境有无死锁
DECLARE @spid INT , @bl INT , @intTransactionCountOnEntry INT , @intRowcount INT , @intCountProperti ...