Skip to content

Commit

Permalink
Add Auto Layout
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeLin committed Sep 10, 2014
1 parent 26a1a2f commit 4913bac
Show file tree
Hide file tree
Showing 17 changed files with 228 additions and 25 deletions.
4 changes: 4 additions & 0 deletions BeautyGallery.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
236CE15119B0B31900B1E85A /* GalleryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 236CE15019B0B31900B1E85A /* GalleryViewController.swift */; };
236CE15319B0B50900B1E85A /* ViewControllerExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 236CE15219B0B50900B1E85A /* ViewControllerExtension.swift */; };
236E400619B5B15A00A4233B /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 236E400519B5B15A00A4233B /* Images.xcassets */; };
239A1C4719BDE32F008DFF40 /* KoreanViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 239A1C4619BDE32F008DFF40 /* KoreanViewController.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand All @@ -38,6 +39,7 @@
236CE15019B0B31900B1E85A /* GalleryViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GalleryViewController.swift; sourceTree = "<group>"; };
236CE15219B0B50900B1E85A /* ViewControllerExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewControllerExtension.swift; sourceTree = "<group>"; };
236E400519B5B15A00A4233B /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
239A1C4619BDE32F008DFF40 /* KoreanViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KoreanViewController.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -83,6 +85,7 @@
236CE13519B0B0FA00B1E85A /* ViewController.swift */,
236CE15219B0B50900B1E85A /* ViewControllerExtension.swift */,
236CE15019B0B31900B1E85A /* GalleryViewController.swift */,
239A1C4619BDE32F008DFF40 /* KoreanViewController.swift */,
236CE13719B0B0FA00B1E85A /* Main.storyboard */,
236E400519B5B15A00A4233B /* Images.xcassets */,
236CE13119B0B0FA00B1E85A /* Supporting Files */,
Expand Down Expand Up @@ -215,6 +218,7 @@
buildActionMask = 2147483647;
files = (
236CE15319B0B50900B1E85A /* ViewControllerExtension.swift in Sources */,
239A1C4719BDE32F008DFF40 /* KoreanViewController.swift in Sources */,
236CE15119B0B31900B1E85A /* GalleryViewController.swift in Sources */,
236CE13619B0B0FA00B1E85A /* ViewController.swift in Sources */,
236CE13419B0B0FA00B1E85A /* AppDelegate.swift in Sources */,
Expand Down
137 changes: 116 additions & 21 deletions BeautyGallery/Base.lproj/Main.storyboard

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions BeautyGallery/Images.xcassets/facebook.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "facebook.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "[email protected]"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions BeautyGallery/Images.xcassets/twitter.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "twitter.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "[email protected]"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions BeautyGallery/Images.xcassets/weibo.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "weibo.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "[email protected]"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions BeautyGallery/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
48 changes: 48 additions & 0 deletions BeautyGallery/KoreanViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
//
// KoreanViewController.swift
// BeautyGallery
//
// Created by Jake Lin on 8/09/2014.
// Copyright (c) 2014 rushjet. All rights reserved.
//


import UIKit
import Social

class KoreanViewController: UIViewController {

@IBOutlet weak var beautyImage: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}

@IBAction func facebookTapped(sender: AnyObject) {
var controller:SLComposeViewController = SLComposeViewController(forServiceType: SLServiceTypeFacebook)
controller.setInitialText("一起来玩女神画廊App,Github上的源码在 https://github.com/JakeLin/BeautyGallery")
controller.addImage(beautyImage.image)
self.presentViewController(controller, animated: true, completion: nil)

}

@IBAction func twitterTapped(sender: AnyObject) {
var controller:SLComposeViewController = SLComposeViewController(forServiceType: SLServiceTypeTwitter)
controller.setInitialText("一起来玩女神画廊App,Github上的源码在 https://github.com/JakeLin/BeautyGallery")
controller.addImage(beautyImage.image)
self.presentViewController(controller, animated: true, completion: nil)
}


@IBAction func weiboTapped(sender: AnyObject) {
var controller:SLComposeViewController = SLComposeViewController(forServiceType: SLServiceTypeSinaWeibo)
controller.setInitialText("一起来玩女神画廊App,Github上的源码在 https://github.com/JakeLin/BeautyGallery")
controller.addImage(beautyImage.image)
self.presentViewController(controller, animated: true, completion: nil)
}
}
2 changes: 1 addition & 1 deletion BeautyGallery/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ViewController: UIViewController {
}

override func prepareForSegue(segue:
UIStoryboardSegue!, sender: AnyObject!) {
UIStoryboardSegue, sender: AnyObject!) {
if segue.identifier == "GoToGallery" {
let index = beautyPicker.selectedRowInComponent(0)

Expand Down
6 changes: 3 additions & 3 deletions BeautyGallery/ViewControllerExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
import UIKit
extension ViewController: UIPickerViewDataSource {
// two required methods
func numberOfComponentsInPickerView(pickerView: UIPickerView!) -> Int {
func numberOfComponentsInPickerView(pickerView: UIPickerView) -> Int {
return 1
}

func pickerView(pickerView: UIPickerView!, numberOfRowsInComponent component: Int) -> Int {
func pickerView(pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return beauties.count
}
}
Expand All @@ -27,7 +27,7 @@ extension ViewController: UIPickerViewDelegate {

// func pickerView(pickerView: UIPickerView!, rowHeightForComponent component: Int) -> CGFloat

func pickerView(pickerView: UIPickerView!, titleForRow row: Int, forComponent component: Int) -> String! {
func pickerView(pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String! {
return beauties[row]
}

Expand Down
Binary file added Screenshots/10-fullsize.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/11-fullsize.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4913bac

Please sign in to comment.