久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <legend id='dpoFh'><style id='dpoFh'><dir id='dpoFh'><q id='dpoFh'></q></dir></style></legend>

    <small id='dpoFh'></small><noframes id='dpoFh'>

    1. <i id='dpoFh'><tr id='dpoFh'><dt id='dpoFh'><q id='dpoFh'><span id='dpoFh'><b id='dpoFh'><form id='dpoFh'><ins id='dpoFh'></ins><ul id='dpoFh'></ul><sub id='dpoFh'></sub></form><legend id='dpoFh'></legend><bdo id='dpoFh'><pre id='dpoFh'><center id='dpoFh'></center></pre></bdo></b><th id='dpoFh'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='dpoFh'><tfoot id='dpoFh'></tfoot><dl id='dpoFh'><fieldset id='dpoFh'></fieldset></dl></div>
      • <bdo id='dpoFh'></bdo><ul id='dpoFh'></ul>

    2. <tfoot id='dpoFh'></tfoot>
    3. iOS 5 Segue 在第一次執(zhí)行后不工作

      iOS 5 Segue not working after the first execution(iOS 5 Segue 在第一次執(zhí)行后不工作)

        <tfoot id='iOXhE'></tfoot>

        1. <legend id='iOXhE'><style id='iOXhE'><dir id='iOXhE'><q id='iOXhE'></q></dir></style></legend>

          <small id='iOXhE'></small><noframes id='iOXhE'>

            • <i id='iOXhE'><tr id='iOXhE'><dt id='iOXhE'><q id='iOXhE'><span id='iOXhE'><b id='iOXhE'><form id='iOXhE'><ins id='iOXhE'></ins><ul id='iOXhE'></ul><sub id='iOXhE'></sub></form><legend id='iOXhE'></legend><bdo id='iOXhE'><pre id='iOXhE'><center id='iOXhE'></center></pre></bdo></b><th id='iOXhE'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='iOXhE'><tfoot id='iOXhE'></tfoot><dl id='iOXhE'><fieldset id='iOXhE'></fieldset></dl></div>
                <bdo id='iOXhE'></bdo><ul id='iOXhE'></ul>
                  <tbody id='iOXhE'></tbody>
              • 本文介紹了iOS 5 Segue 在第一次執(zhí)行后不工作的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                問題描述

                限時送ChatGPT賬號..

                我正在使用情節(jié)提要功能創(chuàng)建一個 iOS5 應(yīng)用程序.基本結(jié)構(gòu)是:

                I'm creating an iOS5 application using the storyboard features. The basic structure is:

                LoginScreen ---(segue)--> MyScreen ---(退出時按下)------(返回登錄屏幕)-->LoginScreen

                LoginScreen ---(segue)--> MyScreen ---(press on logout)------(segue back to login screen)-->LoginScreen

                這很簡單.我管理第一個轉(zhuǎn)場的方式是:

                it's pretty simple. The way I manage the first segue is:

                - (void) onResponse:(NSMutableDictionary *)response {
                  NSLog(@"Login successful,token received");
                  // if the Login was successful,store the token 
                  NSUserDefaults* userPref = [NSUserDefaults standardUserDefaults];    
                  [userPref setObject:[response objectForKey:@"Token"] forKey:@"AuthToken"];
                  [userPref synchronize];
                  //..and let the user getting in
                  [self performSegueWithIdentifier:@"showHomeScreen" sender:nil];
                }
                

                現(xiàn)在,奇怪的是第一次正確執(zhí)行了 segue,但是,當(dāng)我在注銷后返回登錄屏幕時,performSegueWithIdentifier: 不再起作用(沒有錯誤消息,根本沒有任何反應(yīng)).不知道發(fā)生了什么.可能是哪個問題?

                Now,the strange thing is that the segue is correctly performed the first time,but,when I come back to the login screen after a logout the performSegueWithIdentifier: doesn't work anymore (no error messages,simply nothing happens). Not sure what's going on. Which might be the problem?

                我附上了故事板的屏幕截圖..您可以在右上角看到循環(huán):

                I attach a screenshot of the storyboard..you can see the loop in the top-right corner:

                非常感謝!

                克勞斯

                推薦答案

                LoginVC好像連接了不止一個Segue.

                It looks like that LoginVC is connected to more than one Segue.

                處理登錄過程的最佳方法是使用登錄視圖控制器的委托.然后在主 VC 中,檢查憑據(jù)或其他內(nèi)容,如果需要,請為 LoginVC 調(diào)用 performSegue.登錄成功后,調(diào)用委托方法,Main VC 將關(guān)閉模式視圖.LoginVC 真的不應(yīng)該是導(dǎo)航的一部分,也不應(yīng)該連接到除 Main VC 之外的任何其他 Segue.如果您需要,我有一個完整的示例,但是使用委托方法很容易實現(xiàn).

                The best way to handle that Login process is to use a delegate for the Login ViewController. Then in the main VC, you check credentials or whatever and if needed call the performSegue for the LoginVC. When the Login is successful, you call the delegate method and the Main VC will dismiss the modal view. The LoginVC really shouldn't be part of the navigation or connected to any other Segues other than the one from the Main VC. I have a complete example if you need it, but this is easy to implement using delegate methods.

                給你:LoginViewController.h:

                Here ya go: LoginViewController.h:

                @protocol LoginViewControllerDelegate
                    -(void)finishedLoadingUserInfo;
                @end
                
                @interface LoginViewController : UIViewController <UITextFieldDelegate>{
                    id <LoginViewControllerDelegate> delegate;
                }
                

                LoginViewController.m:

                LoginViewController.m:

                @synthesize delegate;
                
                - (void) onResponse:(NSMutableDictionary *)response {
                  NSLog(@"Login successful,token received");
                  // if the Login was successful,store the token 
                  NSUserDefaults* userPref = [NSUserDefaults standardUserDefaults];    
                  [userPref setObject:[response objectForKey:@"Token"] forKey:@"AuthToken"];
                  [userPref synchronize];
                  //..and let the user getting in
                  [delegate finishedLoadingUserInfo];
                }
                

                在 Dashboard VC .m 文件中:

                In the Dashboard VC .m file:

                #pragma mark - LoginViewController Delegate Method
                -(void)finishedLoadingUserInfo
                {    
                    // Dismiss the LoginViewController that we instantiated earlier
                    [self dismissModalViewControllerAnimated:YES];
                    
                    // Do other stuff as needed
                }
                

                所以要點是在應(yīng)用加載時檢查憑據(jù),如果需要,調(diào)用(在 Dashboard VC 中):

                So the gist is to check for credentials when the app loads and if needed, call (in the Dashboard VC):

                [self performSegueWithIdentifier:@"sLogin" sender:nil];
                

                然后在 prepareForSegue 方法中(在 Dashboard VC 中):

                Then in the prepareForSegue method (in the Dashboard VC):

                -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
                    if ([segue.identifier isEqualToString:@"sLogin"]) {
                        LoginViewController *livc = segue.destinationViewController;
                        livc.delegate = self; // For the delegate method
                    }
                }
                

                確保命名 Segue sLogin 否則這將不起作用:)

                Make sure to name the Segue sLogin or this won't work :)

                這篇關(guān)于iOS 5 Segue 在第一次執(zhí)行后不工作的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                相關(guān)文檔推薦

                How to animate a UIImageview to display fullscreen by tapping on it?(如何通過點擊動畫 UIImageview 以顯示全屏?)
                To stop segue and show alert(停止 segue 并顯示警報)
                iOS 5 storyboard, programmatically determine path(iOS 5 故事板,以編程方式確定路徑)
                Icon already includes gloss effects(圖標(biāo)已經(jīng)包含光澤效果)
                How does UIEdgeInsetsMake work?(UIEdgeInsetsMake 是如何工作的?)
                UIProgressView and Custom Track and Progress Images (iOS 5 properties)(UIProgressView 和自定義跟蹤和進(jìn)度圖像(iOS 5 屬性))

                  <tbody id='WFz48'></tbody>
              • <i id='WFz48'><tr id='WFz48'><dt id='WFz48'><q id='WFz48'><span id='WFz48'><b id='WFz48'><form id='WFz48'><ins id='WFz48'></ins><ul id='WFz48'></ul><sub id='WFz48'></sub></form><legend id='WFz48'></legend><bdo id='WFz48'><pre id='WFz48'><center id='WFz48'></center></pre></bdo></b><th id='WFz48'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='WFz48'><tfoot id='WFz48'></tfoot><dl id='WFz48'><fieldset id='WFz48'></fieldset></dl></div>

                    <legend id='WFz48'><style id='WFz48'><dir id='WFz48'><q id='WFz48'></q></dir></style></legend>

                    <small id='WFz48'></small><noframes id='WFz48'>

                      <bdo id='WFz48'></bdo><ul id='WFz48'></ul>

                        • <tfoot id='WFz48'></tfoot>
                          主站蜘蛛池模板: 天天干b| 亚洲电影第三页 | 久久网一区二区 | 国产一区二区三区在线看 | 国产精品国产精品国产专区不片 | 国产美女一区二区 | 成人免费视频观看视频 | 久久久久久高清 | 中文字幕av高清 | 国产成人99久久亚洲综合精品 | 精品久久久一区 | 婷婷开心激情综合五月天 | 国精日本亚洲欧州国产中文久久 | 国产一区精品在线 | 中文字幕高清免费日韩视频在线 | 国产精品黄色 | 中文字幕在线视频免费视频 | 久草免费视 | 国产黄色大片在线免费观看 | 亚洲国产免费 | 亚洲欧美日韩精品久久亚洲区 | 99pao成人国产永久免费视频 | 午夜精品一区二区三区在线播放 | 九九热在线视频观看这里只有精品 | 99久久精品国产一区二区三区 | 粉嫩国产精品一区二区在线观看 | 久久久福利 | 福利片在线观看 | 国产亚洲高清视频 | 成人免费网站www网站高清 | 成人高清在线 | 日本黄色大片免费 | 久久精品欧美一区二区三区不卡 | 伊人狠狠干 | 国产精品2| 九九av| 国产视频一区二区 | 国产在线二区 | 国产精品国产自产拍高清 | 激情av在线 | 成人国产精品久久 |