235 Commits (244e7d99ac74ca51766ccabfb10a1f15b9396e68)

Author SHA1 Message Date
  zhuhaiwen 244e7d99ac java2 3 years ago
  zhuhaiwen eb0516b1e1 web 3 years ago
  zhuhaiwen d64d702ef1 java1 3 years ago
  zhuhaiwen 0e33057656 运行在夏博电脑上了 3 years ago
  zhuhaiwen 2f4121d6ac 单点登录1 3 years ago
  zhuhaiwen 2fbc4e803a 附件下载2 3 years ago
  zhuhaiwen 3dcf64d51d 公告附件下载 3 years ago
  zhuhaiwen 0af78c7d84 a 3 years ago
  zhuhaiwen f674f97209 统计报表1 3 years ago
  zhuhaiwen ae072d11a7 增加节点接口 3 years ago
  zhuhaiwen 1dff4478a5 节点控制 3 years ago
  zhuhaiwen 0b0ef16216 后台页修改 3 years ago
  zhuhaiwen 298a1485b3 后台页:预览合格证 3 years ago
  zhuhaiwen 82ee2f399e 后台页:预览准考证 3 years ago
  zhuhaiwen 49267f0fb1 文件下载2 3 years ago
  zhuhaiwen d8757ed20f 文件下载2 3 years ago
  zhuhaiwen f09d76a1fa 下载1 3 years ago
  zhuhaiwen a61a9bdb6b 文件上传 3 years ago
  zhuhaiwen a4556b507c 张伟昌签名 3 years ago
  zhuhaiwen 46be085d39 groupBy重写 3 years ago
  zhuhaiwen 42f69e8b42 export setProperties 3 years ago
  zhuhaiwen 46d20c1819 报名管理排序 3 years ago
  zhuhaiwen d91f3f8ca9 公告搜索 3 years ago
  zhuhaiwen 78f5b33aaf 手机端公告搜索 3 years ago
  zhuhaiwen 7dedc5997a 有效期2 3 years ago
  zhuhaiwen af2394ecd4 有效期 3 years ago
  zhuhaiwen 2bb6be1b27 数据表名 3 years ago
  zhuhaiwen 548f68c78b 设置是否及格 3 years ago
  zhuhaiwen 07e9217309 后台页面设置作弊状态 3 years ago
  zhuhaiwen c6659a33d7 a 3 years ago
  zhuhaiwen 97603797dd 准考证、合格证规则 3 years ago
  zhuhaiwen 3504f572d7 黑名单bug 3 years ago
  zhuhaiwen 8d62dbd46f 作弊管理 3 years ago
  zhuhaiwen 6b94b0cecd 撤销分配考场修改 3 years ago
  zhuhaiwen 9e5a52e745 华南水利局创建的考点,它的下级都能用 3 years ago
  zhuhaiwen 05594d2e1e 提交个人报名后显示自己的信息 3 years ago
  zhuhaiwen 71ee77515b a 3 years ago
  zhuhaiwen 9844a37d5d a 3 years ago
  zhuhaiwen aadf8d8b9f a 3 years ago
  zhuhaiwen 38df1538e1 提交报名时候判断考试是否存在 3 years ago
  zhuhaiwen d8825f9144 queryHisAll 3 years ago
  zhuhaiwen f5fca736be 层层审核修改 3 years ago
  zhuhaiwen 57af7b43ef a 3 years ago
  zhuhaiwen 0cb1d71f67 a 3 years ago
  zhuhaiwen 43b14432d3 修bug 3 years ago
  zhuhaiwen 24bc5903d3 考点、考场授权2 3 years ago
  zhuhaiwen 1bf5f03484 授权 3 years ago
  zhuhaiwen ab20c07daf 考点、考场组织单位的操作权限 3 years ago
  zhuhaiwen f2b10bff2b 系列、级别2 3 years ago
  zhuhaiwen c1caf8fe75 系列、级别 3 years ago
xiaomo_mobile_ios - Gogs: Go Git Service

小墨的iOS移动端APP代码

朱海文 3e28daaec5 init 3 years ago
..
TTTAttributedLabel 3e28daaec5 init 3 years ago
LICENSE 3e28daaec5 init 3 years ago
README.md 3e28daaec5 init 3 years ago

README.md

TTTAttributedLabel

Circle CI Documentation codecov.io Carthage compatible

A drop-in replacement for UILabel that supports attributes, data detectors, links, and more

TTTAttributedLabel is a drop-in replacement for UILabel providing a simple way to performantly render attributed strings. As a bonus, it also supports link embedding, both automatically with NSTextCheckingTypes and manually by specifying a range for a URL, address, phone number, event, or transit information.

Already using this library? Please comment on this issue to let us know which versions of iOS your app supports.

Even though UILabel received support for NSAttributedString in iOS 6, TTTAttributedLabel has several unique features:

  • Compatibility with iOS >= 4.3
  • Automatic data detection
  • Manual link embedding
  • Label style inheritance for attributed strings
  • Custom styling for links within the label
  • Long-press gestures in addition to tap gestures for links

It also includes advanced paragraph style properties:

  • attributedTruncationToken
  • firstLineIndent
  • highlightedShadowRadius
  • highlightedShadowOffset
  • highlightedShadowColor
  • lineHeightMultiple
  • lineSpacing
  • minimumLineHeight
  • maximumLineHeight
  • shadowRadius
  • textInsets
  • verticalAlignment

Accessibility

As of version 1.10.0, TTTAttributedLabel supports VoiceOver through the UIAccessibilityElement protocol. Each link can be individually selected, with an accessibilityLabel equal to its string value, and a corresponding accessibilityValue for URL, phone number, and date links. Developers who wish to change this behavior or provide custom values should create a subclass and override accessibilityElements.

Communication

  • If you need help, use Stack Overflow. (Tag tttattributedlabel)
  • If you'd like to ask a general question, use Stack Overflow.
  • If you found a bug, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request.

Installation

CocoaPods is the recommended method of installing TTTAttributedLabel. Simply add the following line to your Podfile:

# Podfile

pod 'TTTAttributedLabel'

Usage

TTTAttributedLabel can display both plain and attributed text: just pass an NSString or NSAttributedString to the setText: setter. Never assign to the attributedText property.

// NSAttributedString

TTTAttributedLabel *attributedLabel = [[TTTAttributedLabel alloc] initWithFrame:CGRectZero];

NSAttributedString *attString = [[NSAttributedString alloc] initWithString:@"Tom Bombadil"
                                                                attributes:@{
        (id)kCTForegroundColorAttributeName : (id)[UIColor redColor].CGColor,
        NSFontAttributeName : [UIFont boldSystemFontOfSize:16],
        NSKernAttributeName : [NSNull null],
        (id)kTTTBackgroundFillColorAttributeName : (id)[UIColor greenColor].CGColor
}];

// The attributed string is directly set, without inheriting any other text
// properties of the label.
attributedLabel.text = attString;
// NSString

TTTAttributedLabel *label = [[TTTAttributedLabel alloc] initWithFrame:CGRectZero];
label.font = [UIFont systemFontOfSize:14];
label.textColor = [UIColor darkGrayColor];
label.lineBreakMode = NSLineBreakByWordWrapping;
label.numberOfLines = 0;

// If you're using a simple `NSString` for your text,
// assign to the `text` property last so it can inherit other label properties.
NSString *text = @"Lorem ipsum dolor sit amet";
[label setText:text afterInheritingLabelAttributesAndConfiguringWithBlock:^ NSMutableAttributedString *(NSMutableAttributedString *mutableAttributedString) {
  NSRange boldRange = [[mutableAttributedString string] rangeOfString:@"ipsum dolor" options:NSCaseInsensitiveSearch];
  NSRange strikeRange = [[mutableAttributedString string] rangeOfString:@"sit amet" options:NSCaseInsensitiveSearch];

  // Core Text APIs use C functions without a direct bridge to UIFont. See Apple's "Core Text Programming Guide" to learn how to configure string attributes.
  UIFont *boldSystemFont = [UIFont boldSystemFontOfSize:14];
  CTFontRef font = CTFontCreateWithName((__bridge CFStringRef)boldSystemFont.fontName, boldSystemFont.pointSize, NULL);
  if (font) {
    [mutableAttributedString addAttribute:(NSString *)kCTFontAttributeName value:(__bridge id)font range:boldRange];
    [mutableAttributedString addAttribute:kTTTStrikeOutAttributeName value:@YES range:strikeRange];
    CFRelease(font);
  }

  return mutableAttributedString;
}];

First, we create and configure the label, the same way you would instantiate UILabel. Any text properties that are set on the label are inherited as the base attributes when using the -setText:afterInheritingLabelAttributesAndConfiguringWithBlock: method. In this example, the substring "ipsum dolar", would appear in bold, such that the label would read "Lorem ipsum dolar sit amet", in size 14 Helvetica, with a dark gray color.

IBDesignable

TTTAttributedLabel includes IBInspectable and IB_DESIGNABLE annotations to enable configuring the label inside Interface Builder. However, if you see these warnings when building...

IB Designables: Failed to update auto layout status: Failed to load designables from path (null)
IB Designables: Failed to render instance of TTTAttributedLabel: Failed to load designables from path (null)

...then you are likely using TTTAttributedLabel as a static library, which does not support IB annotations. Some workarounds include:

  • Install TTTAttributedLabel as a dynamic framework using CocoaPods with use_frameworks! in your Podfile, or with Carthage
  • Install TTTAttributedLabel by dragging its source files to your project

Links and Data Detection

In addition to supporting rich text, TTTAttributedLabel can automatically detect links for dates, addresses, URLs, phone numbers, transit information, and allows you to embed your own links.

label.enabledTextCheckingTypes = NSTextCheckingTypeLink; // Automatically detect links when the label text is subsequently changed
label.delegate = self; // Delegate methods are called when the user taps on a link (see `TTTAttributedLabelDelegate` protocol)

label.text = @"Fork me on GitHub! (https://github.com/mattt/TTTAttributedLabel/)"; // Repository URL will be automatically detected and linked

NSRange range = [label.text rangeOfString:@"me"];
[label addLinkToURL:[NSURL URLWithString:@"http://github.com/mattt/"] withRange:range]; // Embedding a custom link in a substring

Demo

pod try TTTAttributedLabel

...or clone this repo and build and run/test the Espressos project in Xcode to see TTTAttributedLabel in action. If you don't have CocoaPods installed, grab it with [sudo] gem install cocoapods.

cd Example
pod install
open Espressos.xcworkspace

Requirements

  • iOS 8+ / tvOS 9+
  • Xcode 6+

License

TTTAttributedLabel is available under the MIT license. See the LICENSE file for more info.