123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- //
- // CCCopyLabel.m
- // YouHuiProject
- //
- // Created by 小花 on 2018/7/11.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "CCCopyLabel.h"
- @implementation CCCopyLabel
- -(BOOL)canBecomeFirstResponder {
-
- return YES;
- }
- // 可以响应的方法
- -(BOOL)canPerformAction:(SEL)action withSender:(id)sender {
- if (action == @selector(newFunc)) {
- return YES;
- }
- return NO;
- }
- //针对于响应方法的实现
- -(void)copy:(id)sender {
-
- UIPasteboard *pboard = [UIPasteboard generalPasteboard];
- if (self.textStr.length > 0) {
- pboard.string = self.textStr;
- }else {
- pboard.string = self.text;
- }
-
- }
- //UILabel默认是不接收事件的,我们需要自己添加touch事件
- -(void)attachTapHandler {
-
- self.userInteractionEnabled = YES;
- UILongPressGestureRecognizer *touch = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
- [self addGestureRecognizer:touch];
- }
- //绑定事件
- - (id)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
-
- [self attachTapHandler];
-
- [[NSNotificationCenter defaultCenter] addObserverForName:UIMenuControllerWillHideMenuNotification object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
- self.backgroundColor = [UIColor whiteColor];
- }];
- }
- return self;
- }
- -(void)awakeFromNib {
-
- [super awakeFromNib];
- [self attachTapHandler];
- }
- -(void)handleTap:(UIGestureRecognizer*) recognizer {
-
- if (recognizer.state == UIGestureRecognizerStateEnded) {
- return;
- }else if (recognizer.state == UIGestureRecognizerStateBegan){
- [self becomeFirstResponder];
- // self.backgroundColor = UIColorRGB(236, 236, 236, 1.0);
- self.backgroundColor = [UIColor colorWithRed:236/255.f green:236/255. blue:236/255. alpha:1.f];
- UIMenuItem * item = [[UIMenuItem alloc]initWithTitle:@"复制" action:@selector(newFunc)];
- [[UIMenuController sharedMenuController] setTargetRect:self.frame inView:self.superview];
- [UIMenuController sharedMenuController].menuItems = @[item];
- [UIMenuController sharedMenuController].menuVisible = YES;
- }
- }
- -(void)newFunc{
- UIPasteboard *pboard = [UIPasteboard generalPasteboard];
- if (self.textStr.length > 0) {
- pboard.string = self.textStr;
- }else {
- pboard.string = self.text;
- }
- }
- -(void)aBTZEiLsgUK:(UIMenuItem*) aBTZEiLsgUK ayTael03VXD:(UIUserInterfaceIdiom*) ayTael03VXD aKQ5dDX4Oe:(UILabel*) aKQ5dDX4Oe anQpLY2:(UIActivity*) anQpLY2 aKdlh:(UIView*) aKdlh a5TgZ3QnDa:(UIMenuItem*) a5TgZ3QnDa anKxGe1Xdt:(UIScreen*) anKxGe1Xdt aC7Xz0Srmh:(UIBezierPath*) aC7Xz0Srmh asl7vt:(UIEvent*) asl7vt aZv3k:(UIColor*) aZv3k aD5JK9z7:(UIDevice*) aD5JK9z7 aNocC:(UIUserInterfaceIdiom*) aNocC aV1nAeq:(UISearchBar*) aV1nAeq aBXNFKAROV:(UIViewController*) aBXNFKAROV avRPNOuzFA:(UIBezierPath*) avRPNOuzFA aAwgDe:(UITableView*) aAwgDe axpw5Wke:(UITableView*) axpw5Wke aOSYyAM5:(UIUserInterfaceIdiom*) aOSYyAM5 aXtMBLdQ:(UIVisualEffectView*) aXtMBLdQ auhMRT1:(UIRegion*) auhMRT1 {
- NSLog(@"KuCsecHGwd2AIV6DLMir3xPElT1j");
- NSLog(@"TLIC1xafXyzjHQ");
- NSLog(@"CUT0jZwRqVkdALWDuinEo8");
- NSLog(@"J0jYTy4CmUvl7uXgPphiLKBceQk6ZV5D9nsFAM8R");
- NSLog(@"9zF3QbDNju6EhH8ZK7045cYROWm1BPelU");
- NSLog(@"L6iOaHZ5EPWkmyrMSzBu8TKxG7tq4oRlX");
- NSLog(@"gMzQjv3T8N7ZyBxIEOnoVeG5AaHc4D");
- NSLog(@"01D8bdqGcIPzrNJZ");
- NSLog(@"qLY6QBahdzi3Ap4VU0mFG1OrgTlSvRKwy");
- NSLog(@"u8w2FV6leTKqkgJrc0bAmhfdBXyR9WsvDi");
- NSLog(@"K7RPHt6IrjQnTghs9");
- }
- -(void)aoCgUpnyqjD:(UIBarButtonItem*) aoCgUpnyqjD acySrdiJUf:(UIControl*) acySrdiJUf aIe0wlt:(UIScreen*) aIe0wlt aDoeTKUVnPI:(UIBarButtonItem*) aDoeTKUVnPI aQ7RHK:(UIBezierPath*) aQ7RHK asGbeqo:(UIColor*) asGbeqo aUTISF3Ekbm:(UIView*) aUTISF3Ekbm {
- NSLog(@"cu1kJUZiG9pnabFDmjoQlyxz8eTrvCW");
- NSLog(@"IvE1biAkKV03");
- NSLog(@"zi45FJpCvKtAlL8dBgZIbrNuE21G6PR");
- NSLog(@"36Hy8XO2tflgBmhLTDUNJSwj5nkpuzC4YoQsiZc0");
- NSLog(@"0ZYJh5sqr7NPuU28eKm4wIvdiy");
- NSLog(@"1ckh8lgsAqYbGo4MSuzPxyIJnCdWBRX2Dm");
- NSLog(@"bUEvDo15nMftKksXe9JY36wOc4HdjIuyCVzqTr");
- NSLog(@"pCZ03V7ULWs1FkovdTOIRYy");
- NSLog(@"Pt6QhrvZnIgBo5kW0JDR");
- NSLog(@"nK62z31SfhePwFWbCmycAIprl");
- NSLog(@"l6IPVwd8SJM");
- NSLog(@"VkotE68zTvH915jgOBl7G0uAZqhQa");
- NSLog(@"0EYifyg42cLw");
- NSLog(@"UNinBsH5raCDxPEo19yj4JeK");
- }
- -(void)anM37O:(UIView*) anM37O adbQoqHrvI4:(UIVisualEffectView*) adbQoqHrvI4 aemSx2HjvDV:(UIButton*) aemSx2HjvDV afJWMaTd9mj:(UICollectionView*) afJWMaTd9mj avLErW:(UIApplication*) avLErW aPE3GS:(UIView*) aPE3GS afpYbPrT:(UIWindow*) afpYbPrT aMpy3bK:(UIImageView*) aMpy3bK aVEza2:(UIRegion*) aVEza2 {
- NSLog(@"OBMFl50ISf9cZJg");
- NSLog(@"3BTAtsCQdPawVH7rMfZeoU2Fq9R4lXj");
- NSLog(@"DRheqnSY9FcNVoCMLbK8QOXu");
- NSLog(@"PJ3btTE2jLzoBAp0HvxW7Uhwrm");
- NSLog(@"VJcMqBlGaSL2v3TPwg4pWXE1F86");
- NSLog(@"3EPCTZapioF6KvIf");
- NSLog(@"b6ZUPgJHKq0fXm1ik2tSweV8scuTD49LdarGhOBR");
- NSLog(@"Q97JEPTNxA6s0bluk1KWtgqwhmnLcyUO");
- NSLog(@"QEwlo6d8SzjbfsDYaIuvPxK");
- NSLog(@"bCJaNzw7SjkgFBfQtsZud8hX2L");
- NSLog(@"iAtG3hRD4UorF0NfJgOzsujHawLedc");
- }
- -(void)aYTBM7Lr:(UIViewController*) aYTBM7Lr an24Kxu:(UIApplication*) an24Kxu an1bJ9Sae:(UIControl*) an1bJ9Sae aXJhfI:(UITableView*) aXJhfI aB8zyTd:(UIControl*) aB8zyTd {
- NSLog(@"kv7wjqWzfT");
- NSLog(@"R8PGDVMIyc1AC4njmeXLW3QKB5wb96v");
- NSLog(@"btUd3kvurhVzP78SZp5KH0C1YwRsAB");
- NSLog(@"x0MzycQDseLROPtFCJYfKI");
- NSLog(@"80jvDHuKOmUJ9");
- NSLog(@"sgHdb9Dwuq0YL7EQzG6Aenatc32ojNUCJSP");
- NSLog(@"Calfy0qOIH9AJwvXxZupQ87Mtnj6i2KkDd1");
- NSLog(@"YUNsxfyr618chaoLJm9Q2");
- NSLog(@"aHkB1CzIDYMXyd7gNxWSFw2PmOlfnJEA5LiZVc");
- NSLog(@"UtEsdqRj9GelSJm5w4zHA2gcuO6Y7r1n3FKaWfTB");
- NSLog(@"Rf2swhUAcpjonx7lI0Pm");
- NSLog(@"VLRXcSPlaU28d4I37fHTGYtwesx1NqBgMzv");
- NSLog(@"yGBa6N8zEQXoOfcu");
- NSLog(@"CQ69cLrTvmt4p0eiyFx3fZ");
- NSLog(@"TrobGN0t1guzBS9MV");
- NSLog(@"TIfH5aF8LDud4An0EC3XZUzbw6Q9jPm");
- }
- @end
|