分類方法主要是不改變原代碼的基礎(chǔ)出上,添加新的方法.
1 如果分類中如果重寫了該類的對象方法,系統(tǒng)會先調(diào)用分類重寫的對象方法.
2 然后在分類中調(diào)用一下super touches 即可.
//UITableView+LJFTouch.m
#import"UITableView+LJFTouch.h"
@implementationUITableView (LJFTouch)
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent*)event{
[supertouchesBegan:toucheswithEvent:event];
NSLog(@"tableView分類方法%s",__func__);
}