UIView 注意问题

 

1. UIView.userInteractionEnabled

UIView.userInteractionEnabled默认值是YES

http://blog.csdn.net/studyrecord/article/details/6536358

如果父视图为ParentView包含一个Button,如果再ParentView上添加子视图ChildView,且ChildView盖住了Button,那么Button就得到不响应了,为了让Button响应,可以设置ChildView的userInteractionEnabled = NO;最近被这个问题困扰了很久,开始想用事件传递的方法,重写类继承自UIView,最后被这简单属性搞定了....

 

2. UILabel UIImageView 的userInteractionEnabled默认为NO, 要注意

3.获取视图相对父视图的CGRect对象

- (CGRect)convertRect:(CGRect)rect toView:(UIView *)view;

posted @ 2014-10-23 17:05  apem  阅读(117)  评论(0编辑  收藏  举报