mirror of
https://github.com/samsonjs/samhuri.net-ios.git
synced 2026-03-25 09:25:47 +00:00
iPad tweaks
This commit is contained in:
parent
e7b6f54935
commit
93dcedd676
7 changed files with 84 additions and 10 deletions
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
/* Begin PBXBuildFile section */
|
||||
1BCFCC637C63C780248D685E /* PostCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 1BCFCB5C36F301B2B93F8069 /* PostCell.m */; };
|
||||
1BCFCD7E8EEBFAA97226B0BF /* UIColor+Hex.m in Sources */ = {isa = PBXBuildFile; fileRef = 1BCFC23988387A5CAE551C90 /* UIColor+Hex.m */; };
|
||||
30089596C2F733D451A454E8 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1613DC56A86AFA7E50460A37 /* libPods.a */; };
|
||||
7B4070531AE46BC9000C2E43 /* auth.json in Resources */ = {isa = PBXBuildFile; fileRef = 7B4070521AE46BC9000C2E43 /* auth.json */; };
|
||||
7B5C4BDF19F2606900667D48 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B5C4BDE19F2606900667D48 /* main.m */; };
|
||||
|
|
@ -42,8 +43,10 @@
|
|||
|
||||
/* Begin PBXFileReference section */
|
||||
1613DC56A86AFA7E50460A37 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1BCFC23988387A5CAE551C90 /* UIColor+Hex.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIColor+Hex.m"; sourceTree = "<group>"; };
|
||||
1BCFCB5C36F301B2B93F8069 /* PostCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PostCell.m; sourceTree = "<group>"; };
|
||||
1BCFCCF30594E0E2DCC32116 /* PostCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PostCell.h; sourceTree = "<group>"; };
|
||||
1BCFCFA1E7D4AFDA984693E1 /* UIColor+Hex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIColor+Hex.h"; sourceTree = "<group>"; };
|
||||
7B4070521AE46BC9000C2E43 /* auth.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = auth.json; sourceTree = "<group>"; };
|
||||
7B5C4BD919F2606900667D48 /* Blog.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Blog.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
7B5C4BDD19F2606900667D48 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
|
|
@ -194,6 +197,8 @@
|
|||
7B9E642A1A227FA20072FF42 /* NSDate+marshmallows.m */,
|
||||
7B9E642B1A227FA20072FF42 /* NSString+marshmallows.h */,
|
||||
7B9E642C1A227FA20072FF42 /* NSString+marshmallows.m */,
|
||||
1BCFC23988387A5CAE551C90 /* UIColor+Hex.m */,
|
||||
1BCFCFA1E7D4AFDA984693E1 /* UIColor+Hex.h */,
|
||||
);
|
||||
name = Categories;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -416,6 +421,7 @@
|
|||
7BE3A0351AE461E700E45CCB /* PreviewViewController.m in Sources */,
|
||||
7B9E644F1A23129B0072FF42 /* BlogStatus.m in Sources */,
|
||||
1BCFCC637C63C780248D685E /* PostCell.m in Sources */,
|
||||
1BCFCD7E8EEBFAA97226B0BF /* UIColor+Hex.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -105,10 +105,12 @@
|
|||
#pragma mark - UISplitViewDelegate methods
|
||||
|
||||
- (BOOL)splitViewController:(UISplitViewController *)splitViewController collapseSecondaryViewController:(UIViewController *)secondaryViewController ontoPrimaryViewController:(UIViewController *)primaryViewController {
|
||||
if ([secondaryViewController isKindOfClass:[UINavigationController class]] && [[(UINavigationController *)secondaryViewController topViewController] isKindOfClass:[EditorViewController class]] && ([(EditorViewController *)[(UINavigationController *)secondaryViewController topViewController] post] == nil)) {
|
||||
UINavigationController *navigationController = [secondaryViewController isKindOfClass:[UINavigationController class]] ? (UINavigationController *)secondaryViewController : nil;
|
||||
if ([navigationController.topViewController isKindOfClass:[EditorViewController class]] && ([(EditorViewController *)navigationController.topViewController post] == nil)) {
|
||||
// Return YES to indicate that we have handled the collapse by doing nothing; the secondary controller will be discarded.
|
||||
return YES;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -157,13 +157,13 @@
|
|||
<scene sceneID="smW-Zh-WAh">
|
||||
<objects>
|
||||
<tableViewController storyboardIdentifier="Master View Controller" title="Posts" useStoryboardIdentifierAsRestorationIdentifier="YES" id="7bK-jq-Zjz" customClass="PostsViewController" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="r7i-6Z-zg0">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="singleLineEtched" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="r7i-6Z-zg0">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="536"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<color key="tintColor" red="0.7953414352" green="0.0" blue="0.013255690590000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<prototypes>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Cell" id="WCw-Qf-5nD" customClass="PostCell">
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="none" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Cell" id="WCw-Qf-5nD" customClass="PostCell">
|
||||
<rect key="frame" x="0.0" y="86" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="WCw-Qf-5nD" id="37f-cq-3Eg">
|
||||
|
|
@ -171,14 +171,14 @@
|
|||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" horizontalCompressionResistancePriority="751" text="2015-04-19" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vd6-ZS-EnM">
|
||||
<rect key="frame" x="494" y="19" width="65" height="15"/>
|
||||
<rect key="frame" x="527" y="15" width="65" height="15"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="12"/>
|
||||
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="I Can't Wait to See What Trey Parker & Matt Stone Do With This" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sTp-VX-x9k">
|
||||
<rect key="frame" x="8" y="14" width="478" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<rect key="frame" x="8" y="13" width="410" height="17"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
|
|
@ -187,13 +187,15 @@
|
|||
<constraint firstItem="vd6-ZS-EnM" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="sTp-VX-x9k" secondAttribute="trailing" constant="8" id="CVb-7u-yaW"/>
|
||||
<constraint firstItem="vd6-ZS-EnM" firstAttribute="trailing" secondItem="37f-cq-3Eg" secondAttribute="trailingMargin" id="ErG-lz-QR2"/>
|
||||
<constraint firstAttribute="centerY" secondItem="sTp-VX-x9k" secondAttribute="centerY" id="L2O-P8-B0I"/>
|
||||
<constraint firstItem="sTp-VX-x9k" firstAttribute="bottom" secondItem="37f-cq-3Eg" secondAttribute="bottomMargin" id="O7g-0A-fpG"/>
|
||||
<constraint firstAttribute="centerY" secondItem="sTp-VX-x9k" secondAttribute="centerY" id="NAj-hm-R7E"/>
|
||||
<constraint firstItem="sTp-VX-x9k" firstAttribute="bottom" secondItem="37f-cq-3Eg" secondAttribute="bottomMargin" constant="-5" id="O7g-0A-fpG"/>
|
||||
<constraint firstItem="vd6-ZS-EnM" firstAttribute="baseline" secondItem="sTp-VX-x9k" secondAttribute="baseline" id="WBb-wO-bu6"/>
|
||||
<constraint firstItem="sTp-VX-x9k" firstAttribute="leading" secondItem="37f-cq-3Eg" secondAttribute="leadingMargin" id="iU2-pk-NdH"/>
|
||||
</constraints>
|
||||
<variation key="default">
|
||||
<mask key="constraints">
|
||||
<exclude reference="L2O-P8-B0I"/>
|
||||
<exclude reference="O7g-0A-fpG"/>
|
||||
</mask>
|
||||
</variation>
|
||||
</tableViewCellContentView>
|
||||
|
|
|
|||
|
|
@ -31,11 +31,23 @@
|
|||
}
|
||||
|
||||
- (void)configureView {
|
||||
NSString *title = nil;
|
||||
NSString *text = nil;
|
||||
CGPoint scrollOffset = CGPointZero;
|
||||
if (self.post) {
|
||||
// FIXME: date, status (draft, published)
|
||||
self.navigationItem.title = self.post.title ?: @"Untitled";
|
||||
self.textView.text = self.post.body;
|
||||
title = self.post.title ?: @"Untitled";
|
||||
text = self.post.body;
|
||||
// TODO: restore scroll offset for this post ... user defaults?
|
||||
}
|
||||
self.navigationItem.title = title;
|
||||
self.textView.text = text;
|
||||
self.textView.contentOffset = scrollOffset;
|
||||
|
||||
BOOL toolbarEnabled = self.post != nil;
|
||||
[self.toolbar.items enumerateObjectsUsingBlock:^(UIBarButtonItem *item, NSUInteger idx, BOOL *stop) {
|
||||
item.enabled = toolbarEnabled;
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
// Copyright (c) 2015 Guru Logic Inc. All rights reserved.
|
||||
//
|
||||
#import "PostCell.h"
|
||||
#import "UIColor+Hex.h"
|
||||
|
||||
@interface PostCell ()
|
||||
|
||||
|
|
@ -16,6 +17,29 @@
|
|||
- (void)configureWithTitle:(NSString *)title date:(NSString *)date {
|
||||
self.titleLabel.text = title;
|
||||
self.dateLabel.text = date;
|
||||
// workaround for iPad bug
|
||||
self.backgroundColor = [UIColor colorWithWhite:0.1333 alpha:1.0];
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated;
|
||||
{
|
||||
UIColor *backgroundColor = [UIColor colorWithWhite:0.1333 alpha:1.0];
|
||||
UIColor *textColor = [UIColor whiteColor];
|
||||
if (selected) {
|
||||
backgroundColor = [UIColor mm_colorFromInteger:0x333333];
|
||||
textColor = [UIColor mm_colorFromInteger:0xAA0000];
|
||||
}
|
||||
|
||||
void (^setProperties)() = ^{
|
||||
self.backgroundColor = backgroundColor;
|
||||
self.titleLabel.textColor = textColor;
|
||||
};
|
||||
if (animated) {
|
||||
[UIView animateWithDuration:0.3 animations:setProperties];
|
||||
}
|
||||
else {
|
||||
setProperties();
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
11
Blog/UIColor+Hex.h
Normal file
11
Blog/UIColor+Hex.h
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
//
|
||||
// Created by Sami Samhuri on 15-04-21.
|
||||
// Copyright (c) 2015 Guru Logic Inc. All rights reserved.
|
||||
//
|
||||
@import UIKit;
|
||||
|
||||
@interface UIColor (Hex)
|
||||
|
||||
+ (UIColor *)mm_colorFromInteger:(NSUInteger)color;
|
||||
|
||||
@end
|
||||
17
Blog/UIColor+Hex.m
Normal file
17
Blog/UIColor+Hex.m
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
//
|
||||
// Created by Sami Samhuri on 15-04-21.
|
||||
// Copyright (c) 2015 Guru Logic Inc. All rights reserved.
|
||||
//
|
||||
#import "UIColor+Hex.h"
|
||||
|
||||
@implementation UIColor (Hex)
|
||||
|
||||
+ (UIColor *)mm_colorFromInteger:(NSUInteger)color;
|
||||
{
|
||||
unsigned char red = color >> 16;
|
||||
unsigned char green = (color >> 8) & 0xff;
|
||||
unsigned char blue = color & 0xff;
|
||||
return [UIColor colorWithRed:red / 255.0 green:green / 255.0 blue:blue / 255.0 alpha:1.0];
|
||||
}
|
||||
|
||||
@end
|
||||
Loading…
Reference in a new issue