iphone Quartz2D使用心得
1,如果视图是从nib中加载的,我们应该首先实现initWithCode:因为nib中的对象实例将存储为归档对象。(某一个view设置为自定义的子view)
hitTest代码范例:
- - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event{
- for (UIView *tmpView in self.subviews )
- {
- if(tmpView.userInteractionEnabled && [tmpView isMemberOfClass:[UIButton class]])
- {
- if (CGRectContainsPoint(tmpView.frame,point)) {
- return tmpView;
- }
- }
- }
- return nil;
- }