Skip to content

Commit

Permalink
初始化
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlinFeng committed Jul 30, 2015
0 parents commit a32baff
Show file tree
Hide file tree
Showing 27 changed files with 1,837 additions and 0 deletions.
522 changes: 522 additions & 0 deletions CFCityPickerVC.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "1"
version = "2.0">
</Bucket>
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0630"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "89F1623D1B68D4B8005556C3"
BuildableName = "CFCityPickerVC.app"
BlueprintName = "CFCityPickerVC"
ReferencedContainer = "container:CFCityPickerVC.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "89F162521B68D4B8005556C3"
BuildableName = "CFCityPickerVCTests.xctest"
BlueprintName = "CFCityPickerVCTests"
ReferencedContainer = "container:CFCityPickerVC.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "89F162521B68D4B8005556C3"
BuildableName = "CFCityPickerVCTests.xctest"
BlueprintName = "CFCityPickerVCTests"
ReferencedContainer = "container:CFCityPickerVC.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "89F1623D1B68D4B8005556C3"
BuildableName = "CFCityPickerVC.app"
BlueprintName = "CFCityPickerVC"
ReferencedContainer = "container:CFCityPickerVC.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "89F1623D1B68D4B8005556C3"
BuildableName = "CFCityPickerVC.app"
BlueprintName = "CFCityPickerVC"
ReferencedContainer = "container:CFCityPickerVC.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "89F1623D1B68D4B8005556C3"
BuildableName = "CFCityPickerVC.app"
BlueprintName = "CFCityPickerVC"
ReferencedContainer = "container:CFCityPickerVC.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>CFCityPickerVC.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>89F1623D1B68D4B8005556C3</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>89F162521B68D4B8005556C3</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
46 changes: 46 additions & 0 deletions CFCityPickerVC/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//
// AppDelegate.swift
// CFCityPickerVC
//
// Created by 冯成林 on 15/7/29.
// Copyright (c) 2015年 冯成林. All rights reserved.
//

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
return true
}

func applicationWillResignActive(application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

func applicationDidEnterBackground(application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

func applicationWillEnterForeground(application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

func applicationDidBecomeActive(application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

func applicationWillTerminate(application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}


}

41 changes: 41 additions & 0 deletions CFCityPickerVC/Base.lproj/LaunchScreen.xib
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6214" systemVersion="14A314h" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6207"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2015年 冯成林. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
<rect key="frame" x="20" y="439" width="441" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="CFCityPickerVC" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
<rect key="frame" x="20" y="140" width="441" height="43"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
<constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l"/>
<constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0"/>
<constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9"/>
<constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="548" y="455"/>
</view>
</objects>
</document>
42 changes: 42 additions & 0 deletions CFCityPickerVC/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="vXZ-lx-hvc">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="ufC-wZ-h7g">
<objects>
<viewController id="vXZ-lx-hvc" customClass="ViewController" customModule="CFCityPickerVC" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="jyV-Pf-zRb"/>
<viewControllerLayoutGuide type="bottom" id="2fi-mo-0CV"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Uw9-Sp-xdw">
<rect key="frame" x="285" y="285" width="30" height="30"/>
<state key="normal" title="展示">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="showAction:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="edM-W4-4Fh"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="centerY" secondItem="Uw9-Sp-xdw" secondAttribute="centerY" id="GXH-mt-OSL"/>
<constraint firstAttribute="centerX" secondItem="Uw9-Sp-xdw" secondAttribute="centerX" id="fKe-Yz-82d"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="581" y="347"/>
</scene>
</scenes>
</document>
44 changes: 44 additions & 0 deletions CFCityPickerVC/CFCityPickerVC/CFCityPickerVC.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// CFCityPickerVC.swift
// CFCityPickerVC
//
// Created by 冯成林 on 15/7/29.
// Copyright (c) 2015年 冯成林. All rights reserved.
//

import UIKit

class CFCityPickerVC: UITableViewController {

var cityModels: [CityModel]!

let cityPVCTintColor = UIColor.grayColor()

/** 可设置:当前城市 */
var currentCity: String!

/** 可设置:热门城市 */
var hotCities: [String]!


lazy var indexTitleLabel: UILabel = {UILabel()}()

var showTime: CGFloat = 1.0

var indexTitleIndexArray: [Int] = []

var selectedCityModel: ((cityModel: CityModel) -> Void)!

lazy var dismissBtn: UIButton = { UIButton(frame: CGRectMake(0, 0, 24, 24)) }()

lazy var selectedCityArray: [String] = {NSUserDefaults.standardUserDefaults().objectForKey(SelectedCityKey) as? [String] ?? []}()

}


extension CFCityPickerVC{

class func getInstance() -> CFCityPickerVC{
return CFCityPickerVC(style: UITableViewStyle.Plain)
}
}
27 changes: 27 additions & 0 deletions CFCityPickerVC/CFCityPickerVC/Common/CFCityPickerVCCommon.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// CFCommon.swift
// CFCityPickerVC
//
// Created by 冯成林 on 15/7/30.
// Copyright (c) 2015年 冯成林. All rights reserved.
//

import Foundation
import UIKit

/** 通知 */
let CityChoosedNoti = "CityChoosedNoti"

/** 归档key */
let SelectedCityKey = "SelectedCityKey"

extension CFCityPickerVC{

class func rgba(r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat) -> UIColor{

return UIColor(red: r/255.0, green: g/255.0, blue: b/255.0, alpha: a)
}


}

37 changes: 37 additions & 0 deletions CFCityPickerVC/CFCityPickerVC/Extendsion/CFCityPickerVC+Main.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//
// CFCityPickerVC+Main.swift
// CFCityPickerVC
//
// Created by 冯成林 on 15/7/30.
// Copyright (c) 2015年 冯成林. All rights reserved.
//

import Foundation
import UIKit


extension CFCityPickerVC {

override func viewDidLoad() {

super.viewDidLoad()

/** 返回按钮 */
dismissBtnPrepare()

/** 为tableView准备 */
tableViewPrepare()
}

/** 返回按钮 */
func dismissBtnPrepare(){

dismissBtn.setImage(UIImage(named: "img.bundle/cancel"), forState: UIControlState.Normal)
dismissBtn.addTarget(self, action: "dismiss", forControlEvents: UIControlEvents.TouchUpInside)
self.navigationItem.leftBarButtonItem = UIBarButtonItem(customView: dismissBtn)
}

func dismiss(){
self.dismissViewControllerAnimated(true, completion: nil)
}
}
Loading

0 comments on commit a32baff

Please sign in to comment.