惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Schneier on Security
有赞技术团队
有赞技术团队
T
The Blog of Author Tim Ferriss
F
Fortinet All Blogs
D
DataBreaches.Net
F
Full Disclosure
腾讯CDC
博客园 - 【当耐特】
MyScale Blog
MyScale Blog
Stack Overflow Blog
Stack Overflow Blog
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
爱范儿
爱范儿
The GitHub Blog
The GitHub Blog
Engineering at Meta
Engineering at Meta
大猫的无限游戏
大猫的无限游戏
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
SegmentFault 最新的问题
The Register - Security
The Register - Security
WordPress大学
WordPress大学
博客园 - 聂微东
雷峰网
雷峰网
J
Java Code Geeks
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Privacy International News Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
A
Arctic Wolf
Scott Helme
Scott Helme
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tor Project blog
博客园 - 三生石上(FineUI控件)
Know Your Adversary
Know Your Adversary
AWS News Blog
AWS News Blog
G
Google Developers Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
CERT Recently Published Vulnerability Notes
O
OpenAI News
Project Zero
Project Zero
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Application and Cybersecurity Blog
Application and Cybersecurity Blog
云风的 BLOG
云风的 BLOG
N
News and Events Feed by Topic
MongoDB | Blog
MongoDB | Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Microsoft Security Blog
Microsoft Security Blog
Cisco Talos Blog
Cisco Talos Blog
P
Palo Alto Networks Blog
Schneier on Security
Schneier on Security

博客园 - 张永存(Jerry)

POD 创建 Xcode 项目组 ReactiveCocoa RACObserve subscribeNext 时,只有值不一样时才响应 ReactiveCocoa 监听Enabled和添加Command出错的处理方法 Masonry + UIView Animations 注意事项 ios中tabbar得title和navigationbar的title如何修改 tableview 分组显示返回footerviewt和headerView的高度不能为0的问题 UITableViewCell的选中时的颜色设置 ios 枚举 位移操作 设置UIButton 字体 颜色 ios NSString format 保留小数点 float double 屏幕自动旋转和调节大小 IOS影响Animiation动画的事件 类似9patch效果的iOS图片拉伸 CocoaPods安装 Mac OS X上安装 Ruby运行环境 XMPP 连续注册出现用户限制:500错误 处理方式 ejabberd 搭配的XMPP服务器注册失败 403 处理 在framework中打包xib 【转】 XMPP ejabberd服务 Mac 安装
addObserver forKeyPath options 注意事项
张永存(Jerry) · 2015-11-27 · via 博客园 - 张永存(Jerry)

[self.layer addObserver:self forKeyPath:@"cornerRadius" options:NSKeyValueObservingOptionNew context:nil];

添加一个监听

在运行过程中可能出现错误

EXC_BAD_ACCESS

这是因为没有在dealloc中removeObserver的问题

但是有时不确定一个监听有没有添加时,

在dealloc进行removeObserver时又会报

because it is not registered as an observer.

这是因为穿点监听没有添加

但IOS不提供addObserver是否添加的判断功能

所以这里最好写为

@try

{

[self.layer removeObserver:self forKeyPath:@"cornerRadius"];

}

@catch(id exception){}

Blog都是随笔,只当做笔记,不会有详细介绍,测试请慎重。。。

posted @ 2015-11-27 12:03  张永存(Jerry)  阅读(1963)  评论(0)    收藏  举报