mirror of
https://github.com/samsonjs/samhuri.net-ios.git
synced 2026-03-25 09:25:47 +00:00
use Font Awesome for icons
This commit is contained in:
parent
39cb0c9776
commit
085607795b
3 changed files with 55 additions and 18 deletions
|
|
@ -6,6 +6,10 @@
|
|||
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
|
||||
</dependencies>
|
||||
<customFonts key="customFonts">
|
||||
<mutableArray key="FontAwesome.otf">
|
||||
<string>FontAwesome</string>
|
||||
<string>FontAwesome</string>
|
||||
</mutableArray>
|
||||
<mutableArray key="MuseoSans-300.otf">
|
||||
<string>MuseoSans-300</string>
|
||||
</mutableArray>
|
||||
|
|
@ -67,14 +71,25 @@
|
|||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="D5w-s5-7oj" userLabel="Link View">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="30"/>
|
||||
<subviews>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Link" translatesAutoresizingMaskIntoConstraints="NO" id="VV9-18-i5M">
|
||||
<rect key="frame" x="0.0" y="0.0" width="30" height="30"/>
|
||||
<button opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalCompressionResistancePriority="751" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="UEU-f2-Xco" userLabel="Link">
|
||||
<rect key="frame" x="0.0" y="4" width="30" height="24"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" secondItem="VV9-18-i5M" secondAttribute="height" multiplier="1:1" id="vkJ-Ki-XVe"/>
|
||||
<constraint firstAttribute="width" secondItem="UEU-f2-Xco" secondAttribute="height" multiplier="1:1" id="HaA-ZR-lpJ"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="20" id="o69-uA-gKN"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<fontDescription key="fontDescription" name="FontAwesome" family="FontAwesome" pointSize="12"/>
|
||||
<state key="normal" title="8">
|
||||
<color key="titleColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<variation key="default">
|
||||
<mask key="constraints">
|
||||
<exclude reference="HaA-ZR-lpJ"/>
|
||||
</mask>
|
||||
</variation>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" restorationIdentifier="Link Button" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ydf-ii-P8M">
|
||||
<rect key="frame" x="32" y="1" width="116" height="29"/>
|
||||
<rect key="frame" x="30" y="1" width="116" height="29"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<state key="normal" title="http://samhuri.net">
|
||||
<color key="titleColor" red="0.96862745098039216" green="0.96862745098039216" blue="0.96862745098039216" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
|
|
@ -85,12 +100,13 @@
|
|||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleAspectFit" restorationIdentifier="Remove Link Button" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="81X-Pe-PFV">
|
||||
<rect key="frame" x="565" y="0.0" width="30" height="30"/>
|
||||
<rect key="frame" x="570" y="0.0" width="30" height="30"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" secondItem="81X-Pe-PFV" secondAttribute="height" multiplier="1:1" id="iW2-b5-VdB"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" name="FontAwesome" family="FontAwesome" pointSize="16"/>
|
||||
<inset key="imageEdgeInsets" minX="4" minY="4" maxX="4" maxY="4"/>
|
||||
<state key="normal" image="Close">
|
||||
<state key="normal" title="X">
|
||||
<color key="titleColor" red="0.96862745100000003" green="0.96862745100000003" blue="0.96862745100000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</state>
|
||||
<connections>
|
||||
|
|
@ -100,19 +116,22 @@
|
|||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="centerY" secondItem="ydf-ii-P8M" secondAttribute="centerY" id="0vl-tP-uea"/>
|
||||
<constraint firstAttribute="bottom" secondItem="VV9-18-i5M" secondAttribute="bottom" id="UNh-Jf-v6Z"/>
|
||||
<constraint firstItem="ydf-ii-P8M" firstAttribute="leading" secondItem="VV9-18-i5M" secondAttribute="trailing" constant="2" id="Xsr-b3-oas"/>
|
||||
<constraint firstAttribute="trailing" secondItem="81X-Pe-PFV" secondAttribute="trailing" constant="5" id="YXc-bD-fWD"/>
|
||||
<constraint firstItem="ydf-ii-P8M" firstAttribute="leading" secondItem="UEU-f2-Xco" secondAttribute="trailing" id="FNL-XF-p0M"/>
|
||||
<constraint firstAttribute="trailing" secondItem="81X-Pe-PFV" secondAttribute="trailing" id="YXc-bD-fWD"/>
|
||||
<constraint firstItem="81X-Pe-PFV" firstAttribute="top" secondItem="D5w-s5-7oj" secondAttribute="top" id="due-NH-8Yi"/>
|
||||
<constraint firstAttribute="bottom" secondItem="81X-Pe-PFV" secondAttribute="bottom" id="gJQ-7t-qks"/>
|
||||
<constraint firstItem="VV9-18-i5M" firstAttribute="top" secondItem="D5w-s5-7oj" secondAttribute="top" id="gw5-CW-hQa"/>
|
||||
<constraint firstItem="UEU-f2-Xco" firstAttribute="leading" secondItem="D5w-s5-7oj" secondAttribute="leading" id="jxm-9a-1oN"/>
|
||||
<constraint firstItem="81X-Pe-PFV" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="ydf-ii-P8M" secondAttribute="trailing" constant="2" id="keD-SD-lgB"/>
|
||||
<constraint firstAttribute="centerY" secondItem="81X-Pe-PFV" secondAttribute="centerY" id="lva-Y3-2ex"/>
|
||||
<constraint firstItem="UEU-f2-Xco" firstAttribute="top" secondItem="D5w-s5-7oj" secondAttribute="top" id="mI8-NB-do8"/>
|
||||
<constraint firstAttribute="bottom" secondItem="UEU-f2-Xco" secondAttribute="bottom" id="mjF-ld-vPr"/>
|
||||
<constraint firstAttribute="height" constant="30" id="q7G-tD-5zK"/>
|
||||
<constraint firstItem="VV9-18-i5M" firstAttribute="leading" secondItem="D5w-s5-7oj" secondAttribute="leading" id="wvv-Ir-t75"/>
|
||||
<constraint firstItem="UEU-f2-Xco" firstAttribute="baseline" secondItem="ydf-ii-P8M" secondAttribute="baseline" id="zDJ-SZ-wgG"/>
|
||||
</constraints>
|
||||
<variation key="default">
|
||||
<mask key="constraints">
|
||||
<exclude reference="mI8-NB-do8"/>
|
||||
<exclude reference="mjF-ld-vPr"/>
|
||||
<exclude reference="lva-Y3-2ex"/>
|
||||
</mask>
|
||||
</variation>
|
||||
|
|
@ -185,6 +204,7 @@ wanted with as little input and thought as possible.</string>
|
|||
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics" statusBarStyle="lightContent"/>
|
||||
<connections>
|
||||
<outlet property="linkButton" destination="ydf-ii-P8M" id="e56-rV-Ztw"/>
|
||||
<outlet property="linkIconButton" destination="UEU-f2-Xco" id="NAc-Ik-oHA"/>
|
||||
<outlet property="linkView" destination="D5w-s5-7oj" id="iRD-md-Gea"/>
|
||||
<outlet property="publishBarButtonItem" destination="qEb-VA-ueB" id="biG-Yd-W5Z"/>
|
||||
<outlet property="removeLinkButton" destination="81X-Pe-PFV" id="Rx0-IH-fzp"/>
|
||||
|
|
@ -370,7 +390,7 @@ wanted with as little input and thought as possible.</string>
|
|||
</connections>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="Rux-fX-hf1" sceneMemberID="firstResponder"/>
|
||||
<barButtonItem systemItem="action" id="8HS-W8-a6l">
|
||||
<barButtonItem title="Publish" style="plain" id="8HS-W8-a6l">
|
||||
<connections>
|
||||
<action selector="publish:" destination="7bK-jq-Zjz" id="zFt-xZ-Pf9"/>
|
||||
</connections>
|
||||
|
|
@ -402,10 +422,6 @@ wanted with as little input and thought as possible.</string>
|
|||
<point key="canvasLocation" x="-45" y="129"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="Close" width="60" height="60"/>
|
||||
<image name="Link" width="67" height="67"/>
|
||||
</resources>
|
||||
<inferredMetricsTieBreakers>
|
||||
<segue reference="6S0-TO-JiA"/>
|
||||
</inferredMetricsTieBreakers>
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@
|
|||
#import "PreviewViewController.h"
|
||||
#import "ChangeTitleViewController.h"
|
||||
#import "ModelStore.h"
|
||||
#import "UIImage+FontAwesome.h"
|
||||
#import "NSString+FontAwesome.h"
|
||||
#import "UIColor+Hex.h"
|
||||
|
||||
@interface EditorViewController () <UITextViewDelegate, UIPopoverPresentationControllerDelegate>
|
||||
|
||||
|
|
@ -22,6 +25,7 @@
|
|||
@property (nonatomic, weak) IBOutlet UITextView *textView;
|
||||
@property (nonatomic, weak) IBOutlet NSLayoutConstraint *textViewTopConstraint;
|
||||
@property (nonatomic, weak) IBOutlet UIView *linkView;
|
||||
@property (nonatomic, weak) IBOutlet UIButton *linkIconButton;
|
||||
@property (nonatomic, weak) IBOutlet UIButton *linkButton;
|
||||
@property (nonatomic, weak) IBOutlet UIButton *removeLinkButton;
|
||||
@property (nonatomic, weak) IBOutlet UIToolbar *toolbar;
|
||||
|
|
@ -168,6 +172,12 @@
|
|||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
[self setupTitleView];
|
||||
[self setupFontAwesomeIcons];
|
||||
}
|
||||
|
||||
- (void)setupFontAwesomeIcons {
|
||||
[self.linkIconButton setTitle:[NSString fontAwesomeIconStringForEnum:FALink] forState:UIControlStateNormal];
|
||||
[self.removeLinkButton setTitle:[NSString fontAwesomeIconStringForEnum:FATimesCircle] forState:UIControlStateNormal];
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
|
|
@ -253,7 +263,7 @@ static NSString *const StateRestorationModifiedPostKey = @"modifiedPost";
|
|||
|
||||
- (void)showHideKeyboardButton;
|
||||
{
|
||||
UIImage *image = [UIImage imageNamed:@"HideKeyboard"];
|
||||
UIImage *image = [UIImage imageWithIcon:@"fa-chevron-up" backgroundColor:[UIColor clearColor] iconColor:[UIColor mm_colorFromInteger:0xAA0000] fontSize:20];
|
||||
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
button.frame = CGRectMake(0, 0, image.size.width, image.size.height);
|
||||
[button setImage:image forState:UIControlStateNormal];
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#import "UIColor+Hex.h"
|
||||
#import "PostCollection.h"
|
||||
#import "ModelStore.h"
|
||||
#import "UIImage+FontAwesome.h"
|
||||
|
||||
@interface PostsViewController ()
|
||||
|
||||
|
|
@ -48,6 +49,7 @@ static const NSUInteger SectionPublished = 1;
|
|||
}
|
||||
|
||||
[self setupTitleView];
|
||||
[self setupFontAwesomeIcons];
|
||||
self.refreshControl.tintColor = [UIColor whiteColor];
|
||||
}
|
||||
|
||||
|
|
@ -73,6 +75,15 @@ static const NSUInteger SectionPublished = 1;
|
|||
[self.view setNeedsLayout];
|
||||
}
|
||||
|
||||
- (void)setupFontAwesomeIcons {
|
||||
UIImage *image = [UIImage imageWithIcon:@"fa-rss" backgroundColor:[UIColor clearColor] iconColor:[UIColor mm_colorFromInteger:0xAA0000] fontSize:20];
|
||||
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[button setImage:image forState:UIControlStateNormal];
|
||||
[button addTarget:self action:@selector(publish:) forControlEvents:UIControlEventTouchUpInside];
|
||||
button.frame = CGRectMake(0, 0, image.size.width, image.size.height);
|
||||
self.publishButton.customView = button;
|
||||
}
|
||||
|
||||
- (void)viewDidLayoutSubviews {
|
||||
[super viewDidLayoutSubviews];
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
|
|
|
|||
Loading…
Reference in a new issue