iOS 开发实用技术导航
NSHipster 中文版
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
http://www.cocos2d-iphone.org/
CocoaPods
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
http://code.google.com/mobile/analytics/
WWDC
https://developer.apple.com/wwdc/
Design Guides and Resources
https://developer.apple.com/design/
Transcripts of WWDC sessions
http://asciiwwdc.com
Cocoa with Love
http://cocoawithlove.com/
Cocoa Dev Central
http://cocoadevcentral.com/
NSHipster
http://nshipster.com/
Style Guides
Google Objective-C Style Guide
NYTimes Objective-C Style Guide
Useful Tools and Services
Charles Web Debugging Proxy
Smore
daiyuechuan
V2EX  ›  iDev

在处理“登陆按钮”的时候,大家用的是哪种 segue 来切换场景呢?

  •  
  •   daiyuechuan ·
    CrazyNeil · Apr 12, 2015 · 3070 views
    This topic created in 4059 days ago, the information mentioned may be changed or developed.
    我一直觉得我的segue有点问题,我用的是viewCronller载入完成后检查当前用户的合法性,然后用instantiateViewControllerWithIdentifier 跳转到别的视图,有没有办法呢,如果直接从按钮建立一个到视图的@IBAction 我不知道如何先判断,再传递,系统默认是一点按钮直接就跳转了。。

    ```
    //检查用户是否已经登录,如果已经登录,直接跳转到主控板
    override func viewDidAppear(animated: Bool){

    var currentUser = PFUser.currentUser()
    if currentUser != nil {
    println("\(currentUser)")
    var sb = UIStoryboard(name: "Main", bundle:nil)
    var vc = sb.instantiateViewControllerWithIdentifier("mainBoardEnter") as UITabBarController
    self.presentViewController(vc, animated:true, completion:nil)
    }
    }
    ```
    2 replies    2015-04-13 12:21:38 +08:00
    Madimo
        1
    Madimo  
       Apr 12, 2015 via iPhone
    检查当前用户的合法性可以放在 AppDelegate 的 ApplicationDidFinishLaunchWithOptions 那个方法里啊,然后直接改 window 的 rootViewController。
    第二个问题,正确姿势是在 Storyboard 中添加一个 ViewController 到 ViewController 的 Segue,然后设定 Segue 的 identifier,然后在按钮的 TouchUpInside 事件响应方法中,需要跳转时用 self.performForSegueWithIdentifier() 来跳转。
    wezzard
        2
    wezzard  
       Apr 13, 2015
    Segue sucks. You need to do it programmatically.
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2832 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 65ms · UTC 14:54 · PVG 22:54 · LAX 07:54 · JFK 10:54
    ♥ Do have faith in what you're doing.