为了独立出组件的一些功能,如,为UIbutton切换背景图片,我们经常需要自定义一些组件,下面是我经常用到的,先总结出来,以后会慢慢更新:
-:UIScroview
srollview的事件经常与其子view事件冲突,截断子view事件的相应
//传递touch事件
- (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event
{
if(!self.dragging)
{
[[selfnextResponder]touchesBegan:toucheswithEvent:event];
}
[supertouchesBegan:touches withEvent:event];
// NSLog(@"MyScrollView touch Began");
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
if(!self.dragging)
{
[[selfnextResponder]touchesMoved:toucheswithEvent:event];
}