Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to add child BONChainables to style text between tags.
- Loading branch information
1 parent
e51b8a8
commit 52fb458
Showing
26 changed files
with
2,014 additions
and
576 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// TagStylesCell.h | ||
// BonMot | ||
// | ||
// Created by Nora Trapp on 3/3/16. | ||
// Copyright © 2016 Zev Eisenberg. All rights reserved. | ||
// | ||
|
||
#import "AbstractCell.h" | ||
|
||
@interface TagStylesCell : AbstractCell | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// | ||
// TagStylesCell.m | ||
// BonMot | ||
// | ||
// Created by Nora Trapp on 3/3/16. | ||
// Copyright © 2016 Zev Eisenberg. All rights reserved. | ||
// | ||
|
||
#import "TagStylesCell.h" | ||
|
||
@interface TagStylesCell () | ||
|
||
@property (weak, nonatomic) IBOutlet UILabel *label; | ||
|
||
@end | ||
|
||
@implementation TagStylesCell | ||
|
||
+ (NSString *)title | ||
{ | ||
return @"Tag Styles"; | ||
} | ||
|
||
- (void)awakeFromNib | ||
{ | ||
[super awakeFromNib]; | ||
|
||
BONChain *boldChain = BONChain.new.fontNameAndSize(@"Baskerville-Bold", 15); | ||
BONChain *italicChain = BONChain.new.fontNameAndSize(@"Baskerville-Italic", 15); | ||
|
||
BONChain *baseChain = BONChain.new.fontNameAndSize(@"Baskerville", 17) | ||
.tagStyles(@[ BONTagMake(@"bold", boldChain), BONTagMake(@"italic", italicChain) ]) | ||
.string(@"<bold>This text is wrapped in a \\<bold> tag.</bold>\n<italic>This text is wrapped in an \\<italic> tag.</italic>"); | ||
|
||
self.label.attributedText = baseChain.attributedString; | ||
|
||
[self.label layoutIfNeeded]; // For auto-sizing cells | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES"> | ||
<dependencies> | ||
<deployment identifier="iOS"/> | ||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/> | ||
<capability name="Constraints to layout margins" minToolsVersion="6.0"/> | ||
</dependencies> | ||
<objects> | ||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> | ||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> | ||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="83" id="d6g-Gc-orO" userLabel="Tag Styles Cell" customClass="TagStylesCell"> | ||
<rect key="frame" x="0.0" y="0.0" width="398" height="83"/> | ||
<autoresizingMask key="autoresizingMask"/> | ||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="d6g-Gc-orO" id="8H7-Bg-FVy"> | ||
<rect key="frame" x="0.0" y="0.0" width="398" height="82.5"/> | ||
<autoresizingMask key="autoresizingMask"/> | ||
<subviews> | ||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="88h-1O-j4A"> | ||
<rect key="frame" x="15" y="8" width="368" height="21"/> | ||
<fontDescription key="fontDescription" type="system" pointSize="17"/> | ||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/> | ||
<nil key="highlightedColor"/> | ||
</label> | ||
</subviews> | ||
<constraints> | ||
<constraint firstItem="88h-1O-j4A" firstAttribute="leading" secondItem="8H7-Bg-FVy" secondAttribute="leadingMargin" constant="7" id="5bp-md-I9T"/> | ||
<constraint firstItem="88h-1O-j4A" firstAttribute="top" secondItem="8H7-Bg-FVy" secondAttribute="top" constant="8" id="92L-uh-jKB"/> | ||
<constraint firstAttribute="trailing" secondItem="88h-1O-j4A" secondAttribute="trailing" constant="15" id="L6f-ru-EoT"/> | ||
<constraint firstAttribute="trailingMargin" secondItem="88h-1O-j4A" secondAttribute="trailing" constant="7" id="SPg-E0-3vK"/> | ||
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="88h-1O-j4A" secondAttribute="bottom" constant="8" id="a9a-dS-3fY"/> | ||
<constraint firstItem="88h-1O-j4A" firstAttribute="leading" secondItem="8H7-Bg-FVy" secondAttribute="leading" constant="15" id="yRF-YX-Lbu"/> | ||
</constraints> | ||
<variation key="default"> | ||
<mask key="constraints"> | ||
<exclude reference="L6f-ru-EoT"/> | ||
<exclude reference="yRF-YX-Lbu"/> | ||
</mask> | ||
</variation> | ||
</tableViewCellContentView> | ||
<connections> | ||
<outlet property="label" destination="88h-1O-j4A" id="Aen-of-Ac3"/> | ||
</connections> | ||
<point key="canvasLocation" x="352" y="424.5"/> | ||
</tableViewCell> | ||
</objects> | ||
</document> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.