CABasicAnimation

CABasicAnimation 自己只有三个property   fromValue  toValue  ByValue

当你创建一个 CABasicAnimation 时,你需要通过-setFromValue 和-setToValue 来指定一个开始值和结束值。 当你增加基础动画到层中的时候,它开始运行。当用属性做动画完成时,例如用位置属性做动画,层就会立刻 返回到它的初始位置 

记住当你做动画时,你至少使用了 2 个对象。这些对象都是层本身,一个层或者层继承的对象,和在先前 的例子中你分配给层的 CABasicAnimation 对象。因为你给动画对象设定了最后的值(目的地),但是并不意 味着当动画完成的时候,层的属性就改变成了最后的值。当动画完成时,你必须显示的设定层的属性,这样动 画结束后,你的层才能真正的到你设定的属性值上。

你可以简单的停止动画到你结束的点上,但是这仅仅是一个视觉效果。层实际的值仍然是一样的。要真的 改变内部的值,就像刚才所说的你必须显示的设定那个属性。例如,显示的设定位置的属性,你需要在层中调 用-setPosition 方法。但是,这会造成一点问题。

如果你通过-set 这个方法显示的设定了层属性的值,那么默认的动画将被执行,而非之前你设定的动画。 在表 3-9 中演示了你设置位置的方法。注意到了,我们使用 position 已经创建了基础动画,但是我们在层上显 示的调用了-setPosition 方法,就覆盖了我们设定的动画,使我们设定的基础动画完全没用了。如果你使用了这 个代码,你会看到虽然我们的层结束的时候放到了正确的位置,但是它使用的是默认的 0.25 秒,而非我们在 动画里显示设定的 5 秒钟。  (Jacky Shin:对于这一点,我倒是没有试出作者所说的情况,也许是因为SDK版本的升级导致,所以这部分文字仅作参考,不一定正确。)

?
1
2
3
4
CABasicAnimation *animation =
[CABasicAnimation animationWithKeyPath:@”position”]; [animation setFromValue:[NSValue valueWithPoint:startPoint]]; [animation setToValue:[NSValue valueWithPoint:endPoint]]; [animation setDuration:5.0];
[layer setPosition:endpoint];
[layer addAnimation:animation forKey:nil];

 因此现在问题出来了,你怎么能使用我们设定的动画呢?看表 3-9 的最后一行,注意到 forKey:这个参数 是被设定为 nil。这就是为什么动画不能覆盖默认动画的原因。如果你改变最后一行为[layer addAnimation:animation forKey:@"position"],动画将会按照我们设定的时间工作。这告诉了层当需要做动画时, 使用我们给关键路径指定的新动画。 

 

下面是一些继承的游泳的属性

Autoreverses

当你设定这个属性为 YES 时,在它到达目的地之后,动画的返回到开始的值,代替了直接跳转到 开始的值。

Duration
Duration 这个参数你已经相当熟悉了。它设定开始值到结束值花费的时间。期间会被速度的属性所影响。 RemovedOnCompletion
这个属性默认为 YES,那意味着,在指定的时间段完成后,动画就自动的从层上移除了。这个一般不用。

假如你想要再次用这个动画时,你需要设定这个属性为 NO。这样的话,下次你在通过-set 方法设定动画的属 性时,它将再次使用你的动画,而非默认的动画。

Speed

默认的值为 1.0.这意味着动画播放按照默认的速度。如果你改变这个值为 2.0,动画会用 2 倍的速度播放。 这样的影响就是使持续时间减半。如果你指定的持续时间为 6 秒,速度为 2.0,动画就会播放 3 秒钟---一半的 持续时间。

BeginTime

这个属性在组动画中很有用。它根据父动画组的持续时间,指定了开始播放动画的时间。默认的是 0.0.组 动画在下个段落中讨论“Animation Grouping”。

TimeOffset

如果一个时间偏移量是被设定,动画不会真正的可见,直到根据父动画组中的执行时间得到的时间都流逝 了。

RepeatCount

默认的是 0,意味着动画只会播放一次。如果指定一个无限大的重复次数,使用 1e100f。这个不应该和 repeatDration 属性一块使用。

RepeatDuration

这个属性指定了动画应该被重复多久。动画会一直重复,直到设定的时间流逝完。它不应该和 repeatCount 一起使用。 

 

 

下面这段英文摘自苹果官方文档,将的是fromValue  toValue  ByValue  怎么使用

The interpolation values are used as follows:

  • Both fromValue and toValue are non-nil. Interpolates between fromValue and toValue.

  • fromValue and byValue are non-nil. Interpolates between fromValue and (fromValue + byValue).

  • byValue and toValue are non-nil. Interpolates between (toValue - byValue) and toValue.

  • fromValue is non-nil. Interpolates between fromValue and the current presentation value of the property.

  • toValue is non-nil. Interpolates between the current value of keyPath in the target layer’s presentation layer andtoValue.

  • byValue is non-nil. Interpolates between the current value of keyPath in the target layer’s presentation layer and that value plus byValue.

  • All properties are nil. Interpolates between the previous value of keyPath in the target layer’s presentation layer and the current value of keyPath in the target layer’s presentation layer.

其他的方法 还是属性等 都是继承而来的

我们可以通过animationWithKeyPath键值对的方式来改变动画

<Jacky Shin:可以从这个网址查到哪些可以做为动画效果, 打开xcode帮助,搜索animatable properties,就可以看到列表>

animationWithKeyPath的值:

  transform.scale = 比例轉換

    transform.scale.x = 闊的比例轉換

    transform.scale.y = 高的比例轉換

    transform.rotation.z = 平面圖的旋轉

    opacity = 透明度

    margin

    zPosition

    backgroundColor    背景颜色

    cornerRadius    圆角

    borderWidth

    bounds

    contents

    contentsRect

    cornerRadius

    frame

    hidden

    mask

    masksToBounds

    opacity

    position

    shadowColor

    shadowOffset

    shadowOpacity

    shadowRadius

 

下面是一些例子

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
    CABasicAnimation *pulse = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
    pulse.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
    pulse.duration = 0.5 + (rand() % 10) * 0.05;
    pulse.repeatCount = 1;
    pulse.autoreverses = YES;
    pulse.fromValue = [NSNumber numberWithFloat:.8];
    pulse.toValue = [NSNumber numberWithFloat:1.2];
    [self.ui_View.layer addAnimation:pulse forKey:nil];
// bounds
  
CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"bounds"];
    anim.duration = 1.f;
    anim.fromValue = [NSValue valueWithCGRect:CGRectMake(0,0,10,10)];
    anim.toValue = [NSValue valueWithCGRect:CGRectMake(10,10,200,200)];
    anim.byValue  = [NSValue valueWithCGRect:self. ui_View.bounds];
//    anim.toValue = (id)[UIColor redColor].CGColor;
//    anim.fromValue =  (id)[UIColor blackColor].CGColor;
     
    anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    anim.repeatCount = 1;
    anim.autoreverses = YES;
     
    [ui_View.layer addAnimation:anim forKey:nil];
//cornerRadius
  
    CABasicAnimation *anim2 = [CABasicAnimation animationWithKeyPath:@"cornerRadius"];
    anim2.duration = 1.f;
    anim2.fromValue = [NSNumber numberWithFloat:0.f];
    anim2.toValue = [NSNumber numberWithFloat:20.f];
    anim2.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    anim2.repeatCount = CGFLOAT_MAX;
    anim2.autoreverses = YES;
     
    [ui_View.layer addAnimation:anim2 forKey:@"cornerRadius"];
//contents
  
CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"contents"];
    anim.duration = 1.f;
    anim.fromValue = (id)[UIImage imageNamed:@"1.jpg"].CGImage;
    anim.toValue = (id)[UIImage imageNamed:@"2.png"].CGImage;
//    anim.byValue  = (id)[UIImage imageNamed:@"3.png"].CGImage;
//    anim.toValue = (id)[UIColor redColor].CGColor;
//    anim.fromValue =  (id)[UIColor blackColor].CGColor;
     
    anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    anim.repeatCount = CGFLOAT_MAX;
    anim.autoreverses = YES;
     
    [ui_View.layer addAnimation:anim forKey:nil];
  
[ui_View.layer setShadowOffset:CGSizeMake(2,2)];
    [ui_View.layer setShadowOpacity:1];
    [ui_View.layer setShadowColor:[UIColor grayColor].CGColor];
//
    CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"shadowColor"];
    anim.duration = 1.f;
    anim.toValue = (id)[UIColor redColor].CGColor;
    anim.fromValue =  (id)[UIColor blackColor].CGColor;
     
    anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    anim.repeatCount = CGFLOAT_MAX;
    anim.autoreverses = YES;
     
    [ui_View.layer addAnimation:anim forKey:nil];
     
    CABasicAnimation *_anim = [CABasicAnimation animationWithKeyPath:@"shadowOffset"];
    _anim.duration = 1.f;
    _anim.fromValue = [NSValue valueWithCGSize:CGSizeMake(0,0)];
    _anim.toValue = [NSValue valueWithCGSize:CGSizeMake(3,3)];
     
    _anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    _anim.repeatCount = CGFLOAT_MAX;
    _anim.autoreverses = YES;
     
    [ui_View.layer addAnimation:_anim forKey:nil];
     
     
    CABasicAnimation *_anim1 = [CABasicAnimation animationWithKeyPath:@"shadowOpacity"];
    _anim1.duration = 1.f;
    _anim1.fromValue = [NSNumber numberWithFloat:0.5];
    _anim1.toValue = [NSNumber numberWithFloat:1];
     
    _anim1.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    _anim1.repeatCount = CGFLOAT_MAX;
    _anim1.autoreverses = YES;
     
    [ui_View.layer addAnimation:_anim1 forKey:nil];
     
     
     
    CABasicAnimation *_anim2 = [CABasicAnimation animationWithKeyPath:@"shadowRadius"];
    _anim2.duration = 1.f;
    _anim2.fromValue = [NSNumber numberWithFloat:10];
    _anim2.toValue = [NSNumber numberWithFloat:5];
     
    _anim2.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    _anim2.repeatCount = CGFLOAT_MAX;
    _anim2.autoreverses = YES;
     
    [ui_View.layer addAnimation:_anim2 forKey:nil];

 下面是一些应用

 

?
几个可以用来实现热门APP应用PATH中menu效果的几个方法
+(CABasicAnimation *)opacityForever_Animation:(float)time //永久闪烁的动画
{
    CABasicAnimation *animation=[CABasicAnimation animationWithKeyPath:@"opacity"];
    animation.fromValue=[NSNumber numberWithFloat:1.0];
    animation.toValue=[NSNumber numberWithFloat:0.0];
    animation.autoreverses=YES;
    animation.duration=time;
    animation.repeatCount=FLT_MAX;
    animation.removedOnCompletion=NO;
    animation.fillMode=kCAFillModeForwards;
    return animation;
}
  
+(CABasicAnimation *)opacityTimes_Animation:(float)repeatTimes durTimes:(float)time; //有闪烁次数的动画
{
    CABasicAnimation *animation=[CABasicAnimation animationWithKeyPath:@"opacity"];
    animation.fromValue=[NSNumber numberWithFloat:1.0];
    animation.toValue=[NSNumber numberWithFloat:0.4];
    animation.repeatCount=repeatTimes;
    animation.duration=time;
    animation.removedOnCompletion=NO;
    animation.fillMode=kCAFillModeForwards;
    animation.timingFunction=[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];
    animation.autoreverses=YES;
    return  animation;
}
  
+(CABasicAnimation *)moveX:(float)time X:(NSNumber *)x //横向移动
{
    CABasicAnimation *animation=[CABasicAnimation animationWithKeyPath:@"transform.translation.x"];
    animation.toValue=x;
    animation.duration=time;
    animation.removedOnCompletion=NO;
    animation.fillMode=kCAFillModeForwards;
    return animation;
}
  
+(CABasicAnimation *)moveY:(float)time Y:(NSNumber *)y //纵向移动
{
    CABasicAnimation *animation=[CABasicAnimation animationWithKeyPath:@"transform.translation.y"];
    animation.toValue=y;
    animation.duration=time;
    animation.removedOnCompletion=NO;
    animation.fillMode=kCAFillModeForwards;
    return animation;
}
  
+(CABasicAnimation *)scale:(NSNumber *)Multiple orgin:(NSNumber *)orginMultiple durTimes:(float)time Rep:(float)repeatTimes //缩放
{
    CABasicAnimation *animation=[CABasicAnimation animationWithKeyPath:@"transform.scale"];
    animation.fromValue=orginMultiple;
    animation.toValue=Multiple;
    animation.duration=time;
    animation.autoreverses=YES;
    animation.repeatCount=repeatTimes;
    animation.removedOnCompletion=NO;
    animation.fillMode=kCAFillModeForwards;
    return animation;
}
  
+(CAAnimationGroup *)groupAnimation:(NSArray *)animationAry durTimes:(float)time Rep:(float)repeatTimes //组合动画
{
    CAAnimationGroup *animation=[CAAnimationGroup animation];
    animation.animations=animationAry;
    animation.duration=time;
    animation.repeatCount=repeatTimes;
    animation.removedOnCompletion=NO;
    animation.fillMode=kCAFillModeForwards;
    return animation;
}
  
+(CAKeyframeAnimation *)keyframeAniamtion:(CGMutablePathRef)path durTimes:(float)time Rep:(float)repeatTimes //路径动画
{
    CAKeyframeAnimation *animation=[CAKeyframeAnimation animationWithKeyPath:@"position"];
    animation.path=path;
    animation.removedOnCompletion=NO;
    animation.fillMode=kCAFillModeForwards;
    animation.timingFunction=[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];
    animation.autoreverses=NO;
    animation.duration=time;
    animation.repeatCount=repeatTimes;
    return animation;
}
  
+(CABasicAnimation *)movepoint:(CGPoint )point //点移动
{
    CABasicAnimation *animation=[CABasicAnimation animationWithKeyPath:@"transform.translation"];
    animation.toValue=[NSValue valueWithCGPoint:point];
    animation.removedOnCompletion=NO;
    animation.fillMode=kCAFillModeForwards;
    return animation;
}
  
+(CABasicAnimation *)rotation:(float)dur degree:(float)degree direction:(int)direction repeatCount:(int)repeatCount //旋转
{
    CATransform3D rotationTransform  = CATransform3DMakeRotation(degree, 0, 0,direction);
    CABasicAnimation* animation;
    animation = [CABasicAnimation animationWithKeyPath:@"transform"];
  
animation.toValue= [NSValue valueWithCATransform3D:rotationTransform];
    animation.duration= dur;
animation.autoreverses= NO;
    animation.cumulative= YES;
    animation.removedOnCompletion=NO;
    animation.fillMode=kCAFillModeForwards;
    animation.repeatCount= repeatCount;
animation.delegate= self;
  
return animation;
}

转载于:https://www.cnblogs.com/yingkong1987/archive/2013/05/12/3073929.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/433557.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

python中func函数用法_python之4类回调函数的使用方法

原标题&#xff1a;python之4类回调函数的使用方法 将函数作为参数传递给另一个函数&#xff0c;一共分为4种情况&#xff1a; 将普通函数传递给普通函数 将普通函数传递给类成员函数 将类成员函数传递给普通函数 将类成员函数传递给类成员函数 这4种情况&#xff0c;在python中…

c#sql防注入模糊查询_SQL中利用LIKE实现模糊查询的功能

大家好&#xff0c;今日继续讲解《VBA数据库解决方案》&#xff0c;今日讲解的内容是&#xff1a;利用ADO,实现模糊查询。在上一讲中&#xff0c;我们实现了利用ADO快速查找的功能&#xff0c;今日我们实现工作表中模糊查找的功能。我们仍是利用上一讲的数据实现, 在"两表…

C++的一般引用及其数组引用

引用就是某一变量&#xff08;目标&#xff09;的一个别名&#xff0c;对引用的操作与对变量直接操作完全一样。 引用的声明方法&#xff1a;类型标识符 &引用名目标变量名&#xff1b; 【例1】&#xff1a;int a; int &raa; //定义引用ra,它是变量a的引用&#xff0…

马云卸任CEO演讲全文:明天起生活将是我的工作

马云&#xff1a;大家晚上好&#xff01;谢谢各位&#xff0c;谢谢大家从全国各地&#xff0c;我知道也有从美国、英国和印度来的同事&#xff0c;感谢大家来到杭州&#xff0c;感谢大家参加淘宝的十周年&#xff01; 今天是一个非常特别的日子&#xff0c;当然对我来讲&#x…

idea断点_IDEA Debug 无法进入断点的解决方法

前言某个多模块项目中使用多个版本的 Spring&#xff0c;如 Spring 4&#xff0c;Spring 5&#xff0c;在使用 IDEA Debug 过程中发现&#xff0c;Spring 部分 jar 如 spring-core 中的上面断点&#xff0c;IDEA 可以成功进入。但是有部分如 spring-context IDEA 始终无法进入断…

win10taskkill无法终止进程_Win10无法终止进程拒绝访问

用任务管理器强制结束一些已经不使用程序的进程&#xff0c;是很多用户会用的功能之一&#xff0c;但是最近有使用win10系统的用户&#xff0c;遇到结束进程的时候&#xff0c;被拒绝访问。遇到这样的问题&#xff0c;给大家带来了这篇文章的方法&#xff0c;希望能帮助到大家。…

c++对数组的引用

所谓数组引用&#xff0c;即指向数组的引用&#xff1b;如 int a[10] ; int (&b)[10] a ;如果写成 int a[10] ;int* &b a ;将会报错&#xff1a; cannot convert from int [10] to int *&。或许你会说在数组名不就是指向这个数组的一个指针吗&#…

python 线程池_老程序员的经验分享:Python 从业十年是种什么体验?

出于某些原因&#xff0c;想记录一下我过去数年使用 Python 的经验和一些感悟。毕竟算是一门把我带入互联网行业的语言&#xff0c;而我近期已经几乎不再写 Py 代码&#xff0c; 做一个记录&#xff0c;也许会对他人起到些微的帮助&#xff0c;也算是纪念与感恩了。作者&#x…

【转】C#中Invoke的用法

在多线程编程中&#xff0c;我们经常要在工作线程中去更新界面显示&#xff0c;而在多线程中直接调用界面控件的方法是错误的做法&#xff0c;Invoke 和 BeginInvoke 就是为了解决这个问题而出现的&#xff0c;使你在多线程中安全的更新界面显示。正确的做法是将工作线程中涉及…

练字格子纸模板pdf_高考英语作文模板(总结八种常考题型,配合例文,纯手打的)...

又是一年高考结束&#xff0c;又有不少新高三的学弟学妹问我一些学习上的方法。额&#xff0c;今天我们就单说这个英语作文。英语作文第一件事练字&#xff0c;其次背模板。高考无非就几种信件变着花考察。几种基本信件模板稍加变通就可以很简单完成作文。本人2019年河南考生&a…

GCC 提供的原子操作

gcc从4.1.2提供了__sync_*系列的built-in函数&#xff0c;用于提供加减和逻辑运算的原子操作。其声明如下&#xff1a;type __sync_fetch_and_add (type *ptr, type value, ...) type __sync_fetch_and_sub (type *ptr, type value, ...) type __sync_fetch_and_or (type *ptr,…

google js cdn_「效率工具」模拟CDN的浏览器扩展程序,改善在线隐私

更多互联网新鲜资讯、工作奇淫技巧关注原创【飞鱼在浪屿】(日更新)LocalCDN是一个Web浏览器扩展&#xff0c;它模仿Content Delivery Networks以改善在线隐私。它拦截流量&#xff0c;在本地找到静态资源&#xff0c;然后将其注入环境。所有这些都是自动发生的&#xff0c;因此…

如何保证战略落地_如何让战略落地:流程管理的道法术器让战略落地提升竞争力...

从0开始学管理&#xff1a;专注科学系统提升管理能力&#xff1a;基础 中层 高层 综合管流程革命一、流程理念流程六要素&#xff1a;客户 、活动间的关系 、活动 、输出 、输入 、价值二、流程浮现什么是端到端的流程&#xff1a;业务全程闭环 、从开始到结束 、从发起到完成 …

出口同比中国经济三大怪状折射出啥危机?

题记&#xff1a;写这篇博客要主是加深自己对出口同比的认识和总结实现算法时的一些验经和训教&#xff0c;如果有错误请指出&#xff0c;万分感谢。 与欧美国家经济相比&#xff0c;中国经济形势更加错综庞杂&#xff0c;这不仅仅是因为中国官方颁布的经济数据掺杂水份&#x…

/sys/class/gpio 文件接口操作IO端口(s3c2440)

在嵌入式设备中对GPIO的操作是最基本的操作。一般的做法是写一个单独驱动程序&#xff0c;网上大多数的例子都是这样的。其实linux下面有一个通用的GPIO操作接口&#xff0c;那就是我要介绍的 “/sys/class/gpio” 方式。 首先&#xff0c;看看系统中有没有“/sys/class/gpio”…

elf文件格式_elf文件,readelf

汽车电子开发过程中&#xff0c;代码完成后&#xff0c;程序编译完成 会生成 elf文件 或 hex文件&#xff0c;可以烧录到MCU中调试&#xff0c;那么究竟什么是 elf文件呢&#xff1f; elf 文件中又包含哪些信息&#xff1f; 如何解析 elf文件呢?1. What is elf fileELF(Execut…

是人是谁_其实,我们每个人心中都有一把尺子,谁好谁歹谁心里都明白……

有一些人&#xff0c;对别人有一点好&#xff0c;就能整天挂在嘴边&#xff0c;生怕别人能忘了似的&#xff0c;还有一些人&#xff0c;对谁好&#xff0c;都不喜欢说在嘴上&#xff0c;就愿意那么默默无闻地善良着&#xff0c;把温暖悄悄传递给别人的心灵&#xff0c;这是我们…

一个伟大计划终于完成了(粉丝联盟网正式上线了)

一个伟大的计划是指 搭建一个拥有独立顶级域名的网站。&#xff08;2009年时&#xff0c;我就有这个想法&#xff0c;今天终于实现了。&#xff09;网站&#xff1a;http://FansUnion.cn/ ; 粉丝联盟网FansUnion的含义 大一时&#xff0c;我开始玩网络游戏-天龙八部。当时取了个…

vector的reserve和resize

vector 的reserve增加了vector的capacity&#xff0c;但是它的size没有改变&#xff01;而 resize 改变了vector的capacity 同时也增加了它的size&#xff01;原因如下&#xff1a;reserve是容器预留空间&#xff0c;但在空间内不真正创建元素对象&#xff0c;所以在没有添加新…

是否要运行此应用程序_使用Delve调试Go应用程序

调试器任何编程语言中最简单的调试形式是使用打印语句或日志来写入标准输出。这肯定没有问题&#xff0c;但是当我们的应用程序规模增加并且逻辑变得更加复杂时&#xff0c;这种方式变得极其困难。将打印语句添加到应用程序的每个代码路径并不容易。这是调试器派上用场的地方。…