Skip to content

Commit

Permalink
Improved legibility by making url field background lighter.
Browse files Browse the repository at this point in the history
  • Loading branch information
thomassnielsen committed Jul 28, 2014
1 parent e7c27b4 commit 9f9c510
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 20 deletions.
12 changes: 2 additions & 10 deletions Assets/PAMWebBrowser_iPad.storyboard
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="5056" systemVersion="13C1021" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="5056" systemVersion="13E28" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
</dependencies>
Expand All @@ -18,15 +18,13 @@
<subviews>
<webView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="c99-AG-HPw">
<rect key="frame" x="0.0" y="0.0" width="768" height="1024"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<connections>
<outlet property="delegate" destination="BYZ-38-t0r" id="8lf-fe-hlY"/>
</connections>
</webView>
<toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="pU2-Rz-FVN">
<rect key="frame" x="0.0" y="0.0" width="768" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="SNh-mR-usG"/>
</constraints>
Expand All @@ -38,7 +36,6 @@
<subviews>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fP0-Hj-lHv">
<rect key="frame" x="-10" y="11" width="36" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" name="EuphemiaUCAS" family="Euphemia UCAS" pointSize="26"/>
<state key="normal" title="&lt;">
<color key="titleColor" red="0.42220336200000003" green="0.4221907258" blue="0.42219790820000003" alpha="1" colorSpace="calibratedRGB"/>
Expand All @@ -62,7 +59,6 @@
<subviews>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="EcQ-HP-rXJ">
<rect key="frame" x="-10" y="11" width="36" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" name="EuphemiaUCAS" family="Euphemia UCAS" pointSize="26"/>
<state key="normal" title=">">
<color key="titleColor" red="0.42220336200000003" green="0.4221907258" blue="0.42219790820000003" alpha="1" colorSpace="calibratedRGB"/>
Expand All @@ -87,11 +83,9 @@
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="BvU-Q3-wMV">
<rect key="frame" x="0.0" y="11" width="580" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="e9w-xW-C9Z">
<rect key="frame" x="10" y="0.0" width="560" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" autocorrectionType="no" keyboardType="URL" returnKeyType="go"/>
Expand All @@ -101,7 +95,6 @@
</textField>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Yw9-y4-zIZ">
<rect key="frame" x="550" y="0.0" width="30" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<constraints>
<constraint firstAttribute="width" constant="30" id="TIl-WT-ks9"/>
</constraints>
Expand Down Expand Up @@ -145,7 +138,6 @@
</toolbar>
<toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="y6B-c7-7oH">
<rect key="frame" x="0.0" y="980" width="768" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="x06-Xm-ZuV"/>
</constraints>
Expand All @@ -155,7 +147,6 @@
</toolbar>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="MIs-bc-7V6" customClass="NJKWebViewProgressView">
<rect key="frame" x="0.0" y="44" width="768" height="3"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="3" id="EFN-cS-kK8"/>
Expand Down Expand Up @@ -190,6 +181,7 @@
<outlet property="topToolbar" destination="pU2-Rz-FVN" id="3TS-NO-AUH"/>
<outlet property="topToolbarHeight" destination="SNh-mR-usG" id="I3b-X7-YoU"/>
<outlet property="urlField" destination="e9w-xW-C9Z" id="1Gl-lK-qdo"/>
<outlet property="urlFieldBg" destination="BvU-Q3-wMV" id="ko1-NK-ipw"/>
<outlet property="urlFieldWrapperItem" destination="Ztv-uF-in8" id="icZ-Bs-wE9"/>
<outlet property="webView" destination="c99-AG-HPw" id="Sha-Cs-MuT"/>
</connections>
Expand Down
13 changes: 3 additions & 10 deletions Assets/PAMWebBrowser_iPhone.storyboard
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="5056" systemVersion="13C1021" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="HXb-Uu-lM6">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6154.17" systemVersion="13E28" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="HXb-Uu-lM6">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6153.11"/>
</dependencies>
<scenes>
<!--Web Browser View Controller-->
Expand All @@ -18,15 +18,13 @@
<subviews>
<webView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="90q-fX-hUn">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<connections>
<outlet property="delegate" destination="HXb-Uu-lM6" id="q7X-Mx-zcn"/>
</connections>
</webView>
<toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="zhh-us-zge">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="Q1q-fG-Zea"/>
</constraints>
Expand All @@ -38,7 +36,6 @@
<subviews>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="abx-7G-FnJ">
<rect key="frame" x="-10" y="11" width="36" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" name="EuphemiaUCAS" family="Euphemia UCAS" pointSize="26"/>
<state key="normal" title="&lt;">
<color key="titleColor" red="0.42220336200000003" green="0.4221907258" blue="0.42219790820000003" alpha="1" colorSpace="calibratedRGB"/>
Expand All @@ -62,7 +59,6 @@
<subviews>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="nNZ-QL-8nd">
<rect key="frame" x="-10" y="11" width="36" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" name="EuphemiaUCAS" family="Euphemia UCAS" pointSize="26"/>
<state key="normal" title=">">
<color key="titleColor" red="0.42220336200000003" green="0.4221907258" blue="0.42219790820000003" alpha="1" colorSpace="calibratedRGB"/>
Expand All @@ -87,11 +83,9 @@
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="yuS-pZ-SyE">
<rect key="frame" x="0.0" y="11" width="160" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="UjO-H7-fXQ">
<rect key="frame" x="10" y="0.0" width="120" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" autocorrectionType="no" keyboardType="URL" returnKeyType="go"/>
Expand All @@ -101,7 +95,6 @@
</textField>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8Tt-5x-P82">
<rect key="frame" x="130" y="0.0" width="30" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<constraints>
<constraint firstAttribute="width" constant="30" id="HkL-Dd-cLQ"/>
</constraints>
Expand Down Expand Up @@ -145,7 +138,6 @@
</toolbar>
<toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="g91-eF-NF9">
<rect key="frame" x="0.0" y="524" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="fFC-2h-nGc"/>
</constraints>
Expand Down Expand Up @@ -177,6 +169,7 @@
<outlet property="topToolbar" destination="zhh-us-zge" id="HF6-VN-EOw"/>
<outlet property="topToolbarHeight" destination="Q1q-fG-Zea" id="o8M-1g-Evs"/>
<outlet property="urlField" destination="UjO-H7-fXQ" id="gak-DQ-U5p"/>
<outlet property="urlFieldBg" destination="yuS-pZ-SyE" id="sre-Nn-bLd"/>
<outlet property="urlFieldRightMargin" destination="45K-a0-Bhu" id="IdV-6D-0Jc"/>
<outlet property="urlFieldWrapperItem" destination="1mK-MF-qls" id="4ca-WX-khe"/>
<outlet property="webView" destination="90q-fX-hUn" id="Fc0-dg-gvS"/>
Expand Down
6 changes: 6 additions & 0 deletions Classes/PAMWebBrowserViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ @interface PAMWebBrowserViewController ()
@property (nonatomic, strong) IBOutlet UIToolbar *topToolbar;
@property (nonatomic, strong) IBOutlet NSLayoutConstraint *topToolbarHeight;
@property (nonatomic, strong) IBOutlet UIBarButtonItem *urlFieldWrapperItem;
@property (nonatomic, strong) IBOutlet UIView *urlFieldBg;
@property (nonatomic, strong) UIColor *urlFieldDefaultBgColor;
@property (nonatomic, strong) IBOutlet UITextField *urlField;
@property (nonatomic, strong) IBOutlet NSLayoutConstraint *urlFieldRightMargin;

Expand Down Expand Up @@ -50,6 +52,8 @@ - (void)viewDidLoad
if (!self.url)
self.url = [NSURL URLWithString:@"http://google.com/"];

self.urlFieldDefaultBgColor = self.urlFieldBg.backgroundColor;

[[self.reloadButton titleLabel] setFont:[UIFont fontWithName:@"FontAwesome" size:self.reloadButton.titleLabel.font.pointSize]];

if (self.hidesDoneButton)
Expand Down Expand Up @@ -233,12 +237,14 @@ - (void)textFieldDidBeginEditing:(UITextField *)textField
self.reloadButton.hidden = YES;
self.urlFieldRightMargin.constant = 0;
[textField selectAll:self];
self.urlFieldBg.backgroundColor = [UIColor colorWithHue:0 saturation:0 brightness:0.9 alpha:1];
}

- (void)textFieldDidEndEditing:(UITextField *)textField
{
self.reloadButton.hidden = NO;
self.urlFieldRightMargin.constant = 30;
self.urlFieldBg.backgroundColor = self.urlFieldDefaultBgColor;
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField
Expand Down

0 comments on commit 9f9c510

Please sign in to comment.