Skip to content

Commit c49f97d

Browse files
committed
ADD: Demo 测试 Builder
1 parent 3c59989 commit c49f97d

File tree

6 files changed

+63
-11
lines changed

6 files changed

+63
-11
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"scale" : "1x"
6+
},
7+
{
8+
"idiom" : "universal",
9+
"filename" : "luffer@2x.jpg",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"scale" : "3x"
15+
}
16+
],
17+
"info" : {
18+
"version" : 1,
19+
"author" : "xcode"
20+
}
21+
}
84.8 KB
Loading
Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,45 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" systemVersion="17A277" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
3+
<device id="retina4_7" orientation="portrait">
4+
<adaptation id="fullscreen"/>
5+
</device>
36
<dependencies>
4-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
7+
<deployment identifier="iOS"/>
8+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
59
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
610
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
711
</dependencies>
812
<scenes>
913
<!--View Controller-->
1014
<scene sceneID="tne-QT-ifu">
1115
<objects>
12-
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController">
16+
<viewController id="BYZ-38-t0r" customClass="ViewController" sceneMemberID="viewController">
1317
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
1418
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
1519
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
20+
<subviews>
21+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Sb3-SW-kcm">
22+
<rect key="frame" x="20" y="60" width="335" height="0.0"/>
23+
<fontDescription key="fontDescription" type="system" pointSize="17"/>
24+
<nil key="textColor"/>
25+
<nil key="highlightedColor"/>
26+
</label>
27+
</subviews>
1628
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
29+
<constraints>
30+
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="Sb3-SW-kcm" secondAttribute="trailing" constant="20" id="927-59-TjO"/>
31+
<constraint firstItem="Sb3-SW-kcm" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="20" id="E1C-Vq-uHx"/>
32+
<constraint firstItem="Sb3-SW-kcm" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" constant="40" id="zzh-BJ-wmr"/>
33+
</constraints>
1734
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
1835
</view>
36+
<connections>
37+
<outlet property="label" destination="Sb3-SW-kcm" id="YET-3g-Wil"/>
38+
</connections>
1939
</viewController>
2040
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
2141
</objects>
42+
<point key="canvasLocation" x="136.80000000000001" y="132.68365817091455"/>
2243
</scene>
2344
</scenes>
2445
</document>

SCRAttributedStringBuilderDemo/SCRAttributedStringBuilderDemo/ViewController.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
@interface ViewController : UIViewController
1212

13+
@property (weak, nonatomic) IBOutlet UILabel *label;
1314

1415
@end
1516

SCRAttributedStringBuilderDemo/SCRAttributedStringBuilderDemo/ViewController.m

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
//
88

99
#import "ViewController.h"
10+
#import "NSString+SCRAttributedStringBuilder.h"
11+
#import "NSMutableAttributedString+SCRAttributedStringBuilder.h"
1012

1113
@interface ViewController ()
1214

@@ -16,14 +18,21 @@ @implementation ViewController
1618

1719
- (void)viewDidLoad {
1820
[super viewDidLoad];
19-
// Do any additional setup after loading the view, typically from a nib.
21+
22+
NSShadow *shadow = [[NSShadow alloc] init];
23+
shadow.shadowColor = [UIColor blueColor];
24+
shadow.shadowOffset = CGSizeMake(2, 2);
25+
NSString *text = @"测试多行文字测试多行文字测试多行文字链接测试多行文字测试多行文字链接测试多行文字测试多行文字测试多行文字链接测试多行文字测试多行文字测试多行文字\n";
26+
self.label.attributedText = @"颜色/字体\n".attributedBuild.fontSize(30).color([UIColor purpleColor])
27+
.append(text).firstLineHeadIndent(20).lineHeight(25).paragraphSpacing(20)
28+
.match(@"链接").hexColor(0xFF4400).backgroundColor([UIColor lightGrayColor])
29+
.matchFirst(@"链接").underlineStyle(NSUnderlineStyleThick).underlineColor([UIColor greenColor])
30+
.matchLast(@"链接").strikethroughStyle(NSUnderlineStyleSingle).strikethroughColor([UIColor yellowColor])
31+
.append(text).alignment(NSTextAlignmentCenter).lineSpacing(10)
32+
.append(@"路飞").font([UIFont systemFontOfSize:25]).strokeWidth(2).strokeColor([UIColor darkGrayColor])
33+
.appendSizeImage([UIImage imageNamed:@"luffer"], CGSizeMake(50, 50))
34+
.insertImage([UIImage imageNamed:@"luffer"], CGSizeMake(50, 50), [UIFont systemFontOfSize:25])
35+
.append(@"\n阴影").shadow(shadow).append(@"基线偏移").baselineOffset(-5);
2036
}
2137

22-
23-
- (void)didReceiveMemoryWarning {
24-
[super didReceiveMemoryWarning];
25-
// Dispose of any resources that can be recreated.
26-
}
27-
28-
2938
@end

0 commit comments

Comments
 (0)