All Projects → xjh093 → JHTapTextView

xjh093 / JHTapTextView

Licence: MIT License
Tap TextView,Text Tap,文本点击

Programming Languages

objective c
16641 projects - #2 most used programming language
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to JHTapTextView

Ybattributetexttapaction
一行代码添加文本点击事件/a fast way to implement click event text
Stars: ✭ 430 (+1769.57%)
Mutual labels:  tap, click
react-native-double-click
A Component Wrapper for Double Click/Tap
Stars: ✭ 42 (+82.61%)
Mutual labels:  tap, click
unitest
🌎 Seamless node and browser unit testing with code coverage
Stars: ✭ 28 (+21.74%)
Mutual labels:  tap
ip2socks
ip flow to socks, support tun and tap.
Stars: ✭ 35 (+52.17%)
Mutual labels:  tap
cloup
Library to build command line interfaces (CLIs) based on Click. Cloup = Click + option groups, constraints, command aliases, command sections, help themes, "did you mean ...?" suggestions ...
Stars: ✭ 44 (+91.3%)
Mutual labels:  click
three-onEvent
Add an EventListener for Object3d in your three.js project.(support click,hover or gaze)
Stars: ✭ 55 (+139.13%)
Mutual labels:  click
clickos
The Click modular router: fast modular packet processing and analysis
Stars: ✭ 127 (+452.17%)
Mutual labels:  click
puppet-homebrew
homebrew (+brewcask! +taps!) package installer and provider
Stars: ✭ 17 (-26.09%)
Mutual labels:  tap
exch
a command-line tool to see currency exchange rates
Stars: ✭ 20 (-13.04%)
Mutual labels:  click
tokio-tun
Asynchronous allocation of TUN/TAP devices in Rust using tokio
Stars: ✭ 17 (-26.09%)
Mutual labels:  tap
XamarinFormsGesture
Xamarin Form Gesture Effects
Stars: ✭ 85 (+269.57%)
Mutual labels:  tap
tap-go
Test Anything Protocol for Go
Stars: ✭ 23 (+0%)
Mutual labels:  tap
profext
👣 Profile Extension - A profile 🔎 search engine for accessing my all social media profile in one tap.👨‍💻👩‍. This chrome extension let's you track your profiles on any account in a single click.
Stars: ✭ 43 (+86.96%)
Mutual labels:  tap
vollt
Java libraries implementing the IVOA protocol: ADQL, UWS and TAP
Stars: ✭ 21 (-8.7%)
Mutual labels:  tap
metronome
An elementary OS app
Stars: ✭ 16 (-30.43%)
Mutual labels:  click
Click-Counter-Bot
A telegram bot module for how to count total clicks on button.
Stars: ✭ 23 (+0%)
Mutual labels:  click
tap-html
📊 an html tap reporter
Stars: ✭ 17 (-26.09%)
Mutual labels:  tap
TAP
A Swift package for the Test Anything Protocol (v13)
Stars: ✭ 21 (-8.7%)
Mutual labels:  tap
configmanager
Forget about configparser, YAML, or JSON parsers. Focus on configuration. NOT RECOMMENDED FOR USE (2019-01-26)
Stars: ✭ 15 (-34.78%)
Mutual labels:  click
cliar
Create modular Python CLIs with type annotations and inheritance
Stars: ✭ 47 (+104.35%)
Mutual labels:  click

JHTapTextView

Tap TextView,文本点击


Version

Latest release version:

1.2.0


Cocoapods

pod "JHTapTextView"


What

image


Usage

    _textView.text = @""
    "秋夕\n"
    "【作者】杜牧 【朝代】唐\n"
    "银烛秋光冷画屏,轻罗小扇扑流萤。\n"
    "天阶夜色凉如水,坐看牵牛织女星。\n"
    "译文😋\n"
    "在秋夜里烛光映照着画屏,手拿着小罗扇扑打萤火虫。夜色里的石阶清凉如冷水,静坐寝宫凝视牛郎织女星。";
    
    _textView.okidoki
    .attributedSubstring(@"杜牧",[UIColor redColor])
    .attributedSubstring(@"唐",[UIColor greenColor])
    .attributedSubstring(@"织女星",[UIColor blueColor]);
    
    __weak typeof(self) wk = self;
    [_textView addTapTexts:@[@"杜牧",@"唐",@"织女星",@"😋"] callback:^(NSString *text, NSRange range) {
        
        NSString *msg = [NSString stringWithFormat:@"text:%@,range:%@",text,NSStringFromRange(range)];
        UIAlertController
        .jhAlertCtrl(@"文本点击", msg, @(1))
        .jh_addNormalAction(@"确定",^{
            
        })
        .jh_show(wk);
        
        NSLog(@"%@",msg);
    }];
    
#pragma mark --- JHTapTextViewDelegate
- (void)tapTextView:(JHTapTextView *)tapTextView didClickText:(NSString *)text range:(NSRange)range
{
    /*
     在 UITableViewCell 中使用 JHTapTextView 时,滑动列表时,当手指是在 JHTapTextView 内时,会触发这个代理事件
     可进行如下判断
     
     If you use `JHTapTextView` in `UITableViewCell`,When you dragging the `UITableView`,
     if you finger is in the bounds of `JHTapTextView`, it will invoke this method,
     so you can do like this:
    */
    
    if (text.length) {
        // your code
        // 点击了某个文字时
    }
    else {
         BOOL flag = self.tableView.isDragging;
         if (!flag) {
             // 处理cell点击事件
             // do something about `UITableViewCell` click
         }
    }
}

- (UITableView *)tableView{
    UIView *tableView = self.superview;
    while (tableView) {
        if ([tableView isKindOfClass:[UITableView class]]) {
            break;
        }
        tableView = tableView.superview;
    }
    return (UITableView *)tableView;
}

Logs

2021-03-17

  • if you add JHTapTextView to a UIScrollView, and the UIScrollView add a UITapGestureRecognizer, you should set tap.cancelsTouchesInView = NO; to cancel delay.

2020-03-26

  • modify delegate method.

2019-09-19

  • fix note "before setText:" -> "after setText:".

2019-04-03

  • 1.fix bug.
  • 2.add tap effect.

2019-01-29

  • 1.add demo.
  • 2.add delegate.

2019-01-28

  • 1.upload.

More detail in Demo :)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].