Giter Club home page Giter Club logo

beautygallery's Introduction

BeautyGallery

Beauty Gallery is an iOS App written in Swift. This app is used for an online video training course. This app demonstrates how to use storyboards and segues, Navigation Controller, Social Framework, Tab Bar Controller and Auto Layout.

Screenshots

BeautyGallery

BeautyGallery

BeautyGallery

中文描述

Beauty Gallery是一个使用Swift语言开发的iOS App,这是免费在线视频课程 女神画廊 app)的源代码,在这个app中,我演示了如何使用Storyboards和Segues, Navigation Controller, Social Framework, Tab Bar Controller以及Auto Layout。

Storyboards和Segues - 女神画廊 app

最终截图

BeautyGallery

BeautyGallery

BeautyGallery

最终源码

Storyboards和Segues课程源码

Navigation Controller - 女神画廊 app

课程开始源码

如果没有学习前面的课程,可以下载下面的源码开始学习。 课程开始源码 请注意,由于Apple不断的修改Swift的编译器,这里需要进行小量修改使得代码可以通过Xcode 6 GM版本的编译。在 Auto Layout - 女神画廊 app 视频中讲述到如何修改这些代码,也可以参考下面的方法进行修改。

在ViewControllerExtension.swift文件

extension ViewController: UIPickerViewDataSource {
    // two required methods
    func numberOfComponentsInPickerView(pickerView: UIPickerView!) -> Int {
        return 1
    }
    
    func pickerView(pickerView: UIPickerView!, numberOfRowsInComponent component: Int) -> Int {
        return beauties.count
    }
}

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

删除UIPickerView后的三个感叹号,修改为

extension ViewController: UIPickerViewDataSource {
    // two required methods
    func numberOfComponentsInPickerView(pickerView: UIPickerView) -> Int {
        return 1
    }
    
    func pickerView(pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
        return beauties.count
    }
}

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

在ViewController.swift文件

override func prepareForSegue(segue:
        UIStoryboardSegue!, sender: AnyObject!) {
            if segue.identifier == "GoToGallery" {
                let index = beautyPicker.selectedRowInComponent(0)
                
                var vc = segue.destinationViewController as GalleryViewController
                switch index {
                case 0:
                    vc.imageName = "fanbingbing"
                case 1:
                    vc.imageName = "libingbing"
                case 2:
                    vc.imageName = "wangfei"
                case 3:
                    vc.imageName = "yangmi"
                case 4:
                    vc.imageName = "zhouxun"
                default:
                    vc.imageName = nil
                }
            }
    }

删除UIStoryboardSegue后的感叹号,修改为

override func prepareForSegue(segue:
        UIStoryboardSegue, sender: AnyObject!) {
            if segue.identifier == "GoToGallery" {
                let index = beautyPicker.selectedRowInComponent(0)
                
                var vc = segue.destinationViewController as GalleryViewController
                switch index {
                case 0:
                    vc.imageName = "fanbingbing"
                case 1:
                    vc.imageName = "libingbing"
                case 2:
                    vc.imageName = "wangfei"
                case 3:
                    vc.imageName = "yangmi"
                case 4:
                    vc.imageName = "zhouxun"
                default:
                    vc.imageName = nil
                }
            }
    }

最终截图

BeautyGallery

BeautyGallery

最终源码

Navigation Controller课程源码

Tab Bar Controller - 女神画廊 app

课程开始源码

如果没有学习前面的课程,可以下载下面的源码开始学习。 课程开始源码 请注意,由于Apple不断的修改Swift的编译器,这里需要进行小量修改使得代码可以通过Xcode 6 GM版本的编译。在 Auto Layout - 女神画廊 app 视频中讲述到如何修改这些代码,也可以参考下面的方法进行修改。

在ViewControllerExtension.swift文件

extension ViewController: UIPickerViewDataSource {
    // two required methods
    func numberOfComponentsInPickerView(pickerView: UIPickerView!) -> Int {
        return 1
    }
    
    func pickerView(pickerView: UIPickerView!, numberOfRowsInComponent component: Int) -> Int {
        return beauties.count
    }
}

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

删除UIPickerView后的三个感叹号,修改为

extension ViewController: UIPickerViewDataSource {
    // two required methods
    func numberOfComponentsInPickerView(pickerView: UIPickerView) -> Int {
        return 1
    }
    
    func pickerView(pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
        return beauties.count
    }
}

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

在ViewController.swift文件

override func prepareForSegue(segue:
        UIStoryboardSegue!, sender: AnyObject!) {
            if segue.identifier == "GoToGallery" {
                let index = beautyPicker.selectedRowInComponent(0)
                
                var vc = segue.destinationViewController as GalleryViewController
                switch index {
                case 0:
                    vc.imageName = "fanbingbing"
                case 1:
                    vc.imageName = "libingbing"
                case 2:
                    vc.imageName = "wangfei"
                case 3:
                    vc.imageName = "yangmi"
                case 4:
                    vc.imageName = "zhouxun"
                default:
                    vc.imageName = nil
                }
            }
    }

删除UIStoryboardSegue后的感叹号,修改为

override func prepareForSegue(segue:
        UIStoryboardSegue, sender: AnyObject!) {
            if segue.identifier == "GoToGallery" {
                let index = beautyPicker.selectedRowInComponent(0)
                
                var vc = segue.destinationViewController as GalleryViewController
                switch index {
                case 0:
                    vc.imageName = "fanbingbing"
                case 1:
                    vc.imageName = "libingbing"
                case 2:
                    vc.imageName = "wangfei"
                case 3:
                    vc.imageName = "yangmi"
                case 4:
                    vc.imageName = "zhouxun"
                default:
                    vc.imageName = nil
                }
            }
    }

最终截图

BeautyGallery

BeautyGallery

BeautyGallery

BeautyGallery

最终源码

Tab Bar Controller课程源码

Auto Layout - 女神画廊 app

课程开始源码

如果没有学习前面的课程,可以下载下面的源码开始学习。 课程开始源码 请注意,由于Apple不断的修改Swift的编译器,这里需要进行小量修改使得代码可以通过Xcode 6 GM版本的编译。在 Auto Layout - 女神画廊 app 视频中讲述到如何修改这些代码,也可以参考下面的方法进行修改。

在ViewControllerExtension.swift文件

extension ViewController: UIPickerViewDataSource {
    // two required methods
    func numberOfComponentsInPickerView(pickerView: UIPickerView!) -> Int {
        return 1
    }
    
    func pickerView(pickerView: UIPickerView!, numberOfRowsInComponent component: Int) -> Int {
        return beauties.count
    }
}

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

删除UIPickerView后的三个感叹号,修改为

extension ViewController: UIPickerViewDataSource {
    // two required methods
    func numberOfComponentsInPickerView(pickerView: UIPickerView) -> Int {
        return 1
    }
    
    func pickerView(pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
        return beauties.count
    }
}

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

在ViewController.swift文件

override func prepareForSegue(segue:
        UIStoryboardSegue!, sender: AnyObject!) {
            if segue.identifier == "GoToGallery" {
                let index = beautyPicker.selectedRowInComponent(0)
                
                var vc = segue.destinationViewController as GalleryViewController
                switch index {
                case 0:
                    vc.imageName = "fanbingbing"
                case 1:
                    vc.imageName = "libingbing"
                case 2:
                    vc.imageName = "wangfei"
                case 3:
                    vc.imageName = "yangmi"
                case 4:
                    vc.imageName = "zhouxun"
                default:
                    vc.imageName = nil
                }
            }
    }

删除UIStoryboardSegue后的感叹号,修改为

override func prepareForSegue(segue:
        UIStoryboardSegue, sender: AnyObject!) {
            if segue.identifier == "GoToGallery" {
                let index = beautyPicker.selectedRowInComponent(0)
                
                var vc = segue.destinationViewController as GalleryViewController
                switch index {
                case 0:
                    vc.imageName = "fanbingbing"
                case 1:
                    vc.imageName = "libingbing"
                case 2:
                    vc.imageName = "wangfei"
                case 3:
                    vc.imageName = "yangmi"
                case 4:
                    vc.imageName = "zhouxun"
                default:
                    vc.imageName = nil
                }
            }
    }

最终截图

BeautyGallery

BeautyGallery

最终源码

Auto Layout课程源码

beautygallery's People

Contributors

jakelin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

beautygallery's Issues

warning message

warning: Unsupported Configuration: Scene is unreachable due to lack of entry points and does not have an identifier for runtime access via -instantiateViewControllerWithIdentifier:.

what's going on ?

不能点击korean,一点击就程序崩溃

严格按照课程来写的,只换了一下korean的位置,不能点击korean,点击就出错,定位到 AppDelegate.swift 中

2015-05-04 17:15:16.538 BeautyGallery[2062:1168010] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<BeautyGallery.JapanViewController 0x7fb6da448de0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key beautyImage.'
*** First throw call stack:
(
0 CoreFoundation 0x000000010d7acc65 exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010f449bb7 objc_exception_throw + 45
2 CoreFoundation 0x000000010d7ac8a9 -[NSException raise] + 9
3 Foundation 0x000000010dbcab53 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 259
4 CoreFoundation 0x000000010d6f4d50 -[NSArray makeObjectsPerformSelector:] + 224
5 UIKit 0x000000010e45552b -[UINib instantiateWithOwner:options:] + 1506
6 UIKit 0x000000010e2ad718 -[UIViewController _loadViewFromNibNamed:bundle:] + 242
7 UIKit 0x000000010e2add08 -[UIViewController loadView] + 109
8 UIKit 0x000000010e2adf79 -[UIViewController loadViewIfRequired] + 75
9 UIKit 0x000000010e2ae40e -[UIViewController view] + 27
10 UIKit 0x000000010e2f304f -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] + 360
11 UIKit 0x000000010e2ef1fa -[UITabBarController _setSelectedViewController:] + 311
12 UIKit 0x000000010e2f26b8 -[UITabBarController _tabBarItemClicked:] + 259
13 UIKit 0x000000010e17eda2 -[UIApplication sendAction:to:from:forEvent:] + 75
14 UIKit 0x000000010e465536 -[UITabBar _sendAction:withEvent:] + 451
15 UIKit 0x000000010e17eda2 -[UIApplication sendAction:to:from:forEvent:] + 75
16 UIKit 0x000000010e29054a -[UIControl _sendActionsForEvents:withEvent:] + 467
17 UIKit 0x000000010e469a92 -[UITabBar(Static) _buttonUp:] + 103
18 UIKit 0x000000010e17eda2 -[UIApplication sendAction:to:from:forEvent:] + 75
19 UIKit 0x000000010e29054a -[UIControl _sendActionsForEvents:withEvent:] + 467
20 UIKit 0x000000010e28f919 -[UIControl touchesEnded:withEvent:] + 522
21 UIKit 0x000000010e1cb998 -[UIWindow _sendTouchesForEvent:] + 735
22 UIKit 0x000000010e1cc2c2 -[UIWindow sendEvent:] + 682
23 UIKit 0x000000010e192581 -[UIApplication sendEvent:] + 246
24 UIKit 0x000000010e19fd1c _UIApplicationHandleEventFromQueueEvent + 18265
25 UIKit 0x000000010e17a5dc _UIApplicationHandleEventQueue + 2066
26 CoreFoundation 0x000000010d6e0431 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION
+ 17
27 CoreFoundation 0x000000010d6d62fd __CFRunLoopDoSources0 + 269
28 CoreFoundation 0x000000010d6d5934 __CFRunLoopRun + 868
29 CoreFoundation 0x000000010d6d5366 CFRunLoopRunSpecific + 470
30 GraphicsServices 0x0000000110e67a3e GSEventRunModal + 161
31 UIKit 0x000000010e17d900 UIApplicationMain + 1282
32 BeautyGallery 0x000000010d5ad697 main + 135
33 libdyld.dylib 0x000000010fba1145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.