<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          NudeIniOS 端富文本控件

          聯(lián)合創(chuàng)作 · 2023-09-26 17:42

          NudeIn

          NudeIn 是一個(gè)基于 UITextView ,書寫風(fēng)格類似于 masonry 的 iOS 端富文本控件,它采用優(yōu)雅的聲明式方法定義富文本控件,和編程式的不同,它所需的代碼量相當(dāng)短,且非常直觀易用。

          Usage

          NudeIn 的用法非常簡單明了,這里給出一個(gè)非常簡單的例子,相信你會被這樣的用法驚艷到,一旦用起來就會愛不釋手:

          1、引入控件

          #import "NudeIn.h"

          2、聲明控件為你的成員變量

          @property (nonatomic,strong) NudeIn *attrLabel;

          3、Do it yourself

          _attrLabel = [NudeIn make:^(NUDTextMaker *make) {
              make.text(@"this is a ").font(14).color([UIColor blackColor]).attach();
              make.text(@"BlueLink").font(17).color([UIColor blueColor]).link(self,@selector(linkHandler:)).attach();
              make.text(@", and this is a ").font(14).color([UIColor blackColor]).attach();
              make.text(@"RedLink").font(17).color([UIColor redColor]).link(self,@selector(linkHandler:)).attach();
          }];

          3、對聲明了 link 屬性的部分定義回調(diào)

          - (void)linkHandler:(NUDAction *)action {
              
              if ([action isKindOfClass:[NUDLinkAction class]]) {
                  
                  NUDLinkAction *linkAction = (NUDLinkAction *)action;
                  
                  UIAlertController *alertController = [UIAlertController alertControllerWithTitle:linkAction.string message:nil preferredStyle:UIAlertControllerStyleAlert];
              
                  [alertController addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                  }]];
                  
                  [self presentViewController:alertController animated:YES completion:nil];
                  
              }
              
          }

          結(jié)果會是這樣:

          點(diǎn)擊帶有 link 屬性的部分,將產(chǎn)生回調(diào):

          Installation

          pod 'NudeIn' '~> 1.2.1-beta'

          最新 pod 版本:1.2.1-beta

          目前該版本屬于不穩(wěn)定版本

          最低 iOS 版本: 8.0

          License

          NudeIn is released under the MIT license. See LICENSE for details.

          瀏覽 24
          點(diǎn)贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          評論
          圖片
          表情
          推薦
          點(diǎn)贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  毛片免费基地 | 无码高清视频在线观看 | 久热这里只有精品89 | 黄色一级电影免费 | 一本大道久久无码精品一区二区三区 |