iOS App中UILabel的自定义及在Auto Layout中的使用
自定义UILabel,接受触摸事件:
#import<UIKit/UIKit.h> @interfacemyLabel:UILabel @end
#import"myLabel.h"
@implementationmyLabel
-(id)initWithFrame:(CGRect)frame { self=[superinitWithFrame:frame]; if(self){ //Initializationcode } returnself; }
-(void)touchesBegan:(NSSet*)toucheswithEvent:(UIEvent*)event{ NSLog(@"myLabeltouch"); }
@end