Skip to content

Commit

Permalink
day1_2
Browse files Browse the repository at this point in the history
  • Loading branch information
xiyuxifeng committed Jul 29, 2015
1 parent 0e84371 commit 24bde4c
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 11 deletions.
8 changes: 8 additions & 0 deletions Autolayout.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

/* Begin PBXBuildFile section */
2D66C3C21B68D04B00D0D707 /* Extend.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D66C3C11B68D04B00D0D707 /* Extend.swift */; };
7B5146731B6913C2006B2F2A /* HomeTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B5146711B6913C2006B2F2A /* HomeTableViewCell.swift */; };
7B5146741B6913C2006B2F2A /* HomeTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7B5146721B6913C2006B2F2A /* HomeTableViewCell.xib */; };
7B82000A1B66846B00B454BD /* HomeSearchBarView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7B8200091B66846B00B454BD /* HomeSearchBarView.xib */; };
7B82000C1B66847800B454BD /* HomeSearchBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B82000B1B66847800B454BD /* HomeSearchBarView.swift */; };
7B8200151B66887F00B454BD /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7B8200141B66887F00B454BD /* Images.xcassets */; };
Expand All @@ -30,6 +32,8 @@

/* Begin PBXFileReference section */
2D66C3C11B68D04B00D0D707 /* Extend.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Extend.swift; sourceTree = "<group>"; };
7B5146711B6913C2006B2F2A /* HomeTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HomeTableViewCell.swift; sourceTree = "<group>"; };
7B5146721B6913C2006B2F2A /* HomeTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = HomeTableViewCell.xib; sourceTree = "<group>"; };
7B8200091B66846B00B454BD /* HomeSearchBarView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = HomeSearchBarView.xib; sourceTree = "<group>"; };
7B82000B1B66847800B454BD /* HomeSearchBarView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HomeSearchBarView.swift; sourceTree = "<group>"; };
7B8200141B66887F00B454BD /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
Expand Down Expand Up @@ -75,6 +79,8 @@
children = (
7B8200091B66846B00B454BD /* HomeSearchBarView.xib */,
7B82000B1B66847800B454BD /* HomeSearchBarView.swift */,
7B5146711B6913C2006B2F2A /* HomeTableViewCell.swift */,
7B5146721B6913C2006B2F2A /* HomeTableViewCell.xib */,
);
name = HomeView;
sourceTree = "<group>";
Expand Down Expand Up @@ -220,6 +226,7 @@
7BC03A8E1B63D0B00049DE32 /* Main.storyboard in Resources */,
7B8200151B66887F00B454BD /* Images.xcassets in Resources */,
7B82000A1B66846B00B454BD /* HomeSearchBarView.xib in Resources */,
7B5146741B6913C2006B2F2A /* HomeTableViewCell.xib in Resources */,
7BC03A931B63D0B00049DE32 /* LaunchScreen.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -239,6 +246,7 @@
buildActionMask = 2147483647;
files = (
7B82000C1B66847800B454BD /* HomeSearchBarView.swift in Sources */,
7B5146731B6913C2006B2F2A /* HomeTableViewCell.swift in Sources */,
7BC03A8B1B63D0B00049DE32 /* ViewController.swift in Sources */,
7BC03A891B63D0B00049DE32 /* AppDelegate.swift in Sources */,
2D66C3C21B68D04B00D0D707 /* Extend.swift in Sources */,
Expand Down
8 changes: 4 additions & 4 deletions Autolayout/Base.lproj/Main.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="7706" systemVersion="14C109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="7Du-Uy-cHD">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7706" systemVersion="14E46" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="7Du-Uy-cHD">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
</dependencies>
Expand All @@ -17,14 +17,14 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Da9-7P-P1j">
<rect key="frame" x="0.0" y="64" width="600" height="160"/>
<rect key="frame" x="0.0" y="64" width="600" height="187"/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="160" id="KEv-AU-xaT"/>
<constraint firstAttribute="height" constant="187" id="KEv-AU-xaT"/>
</constraints>
</scrollView>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="133" sectionHeaderHeight="22" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="3HY-em-uSo">
<rect key="frame" x="0.0" y="232" width="600" height="324"/>
<rect key="frame" x="0.0" y="259" width="600" height="297"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="175" id="c3j-Li-S54">
Expand Down
6 changes: 3 additions & 3 deletions Autolayout/Extend.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ let IS_RETINA = UIScreen.mainScreen().scale >= 2.0

let SCREEN_WIDTH = UIScreen.mainScreen().bounds.size.width
let SCREEN_HEIGHT = UIScreen.mainScreen().bounds.size.height
let SCREEN_MAX_LENGTH = min(SCREEN_HEIGHT, SCREEN_WIDTH)
let SCREEN_MIN_LENGTH = max(SCREEN_WIDTH, SCREEN_HEIGHT)
let SCREEN_MAX_LENGTH = max(SCREEN_HEIGHT, SCREEN_WIDTH)
let SCREEN_MIN_LENGTH = min(SCREEN_WIDTH, SCREEN_HEIGHT)

let IS_IPHONE_4_OR_LESS = IS_IPHONE && (SCREEN_MAX_LENGTH) < 568.0
let IS_IPHONE_5 = IS_IPHONE && (SCREEN_MAX_LENGTH) == 568.0
let IS_IPHONE_6 = IS_IPHONE && (SCREEN_MAX_LENGTH) == 667.0
let IS_IPHONE_6_PLUS = IS_IPHONE && (SCREEN_MAX_LENGTH) == 736.0
let IS_IPHONE_6P = IS_IPHONE && (SCREEN_MAX_LENGTH) == 736.0
4 changes: 3 additions & 1 deletion Autolayout/HomeSearchBarView.xib
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.XIB" version="3.0" toolsVersion="7706" systemVersion="14C109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14E46" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
</dependencies>
Expand All @@ -24,6 +24,7 @@
<color key="titleColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="selected" backgroundImage="首页搜索框-点击态"/>
</button>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="首页-搜索图标" translatesAutoresizingMaskIntoConstraints="NO" id="92b-q5-xHg">
<rect key="frame" x="18" y="10" width="20" height="20"/>
Expand Down Expand Up @@ -71,6 +72,7 @@
</objects>
<resources>
<image name="首页搜索框" width="304" height="30"/>
<image name="首页搜索框-点击态" width="304" height="30"/>
<image name="首页查看附近俱乐部图标-点击态" width="19" height="19"/>
<image name="首页-搜索图标" width="12" height="13"/>
</resources>
Expand Down
24 changes: 24 additions & 0 deletions Autolayout/HomeTableViewCell.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// HomeTableViewCell.swift
// Autolayout
//
// Created by 王辉 on 15/7/29.
// Copyright (c) 2015年 Wang.Hui. All rights reserved.
//

import UIKit

class HomeTableViewCell: UITableViewCell {

override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}

override func setSelected(selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)

// Configure the view for the selected state
}

}
18 changes: 18 additions & 0 deletions Autolayout/HomeTableViewCell.xib
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6211" systemVersion="14A298i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6204"/>
</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" id="KGk-i7-Jjw" customClass="HomeTableViewCell" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
<autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView>
</tableViewCell>
</objects>
</document>
8 changes: 5 additions & 3 deletions Autolayout/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,19 @@ class ViewController: UIViewController {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.


var homeSearchBar: HomeSearchBarView = (UINib(nibName: "HomeSearchBarView", bundle: nil).instantiateWithOwner(self, options: nil).first) as! HomeSearchBarView

self.navigationItem.titleView = homeSearchBar

homeSearchBar.searchBtn.addTarget(self, action: "gotoSearchVC", forControlEvents: UIControlEvents.TouchUpInside)

if IS_IPHONE_6P {
ScrollViewHeight.constant = 621.0 / 3.0
}
}

func gotoSearchVC() {
println("Test: \(self.ScrollViewHeight.description)")
println("Test: \(self.ScrollViewHeight!.description)")
}

func gotoMapVC() {
Expand Down

0 comments on commit 24bde4c

Please sign in to comment.