有几次与performSegueWithIdentifier一起出现问题

时间:2014-04-16 17:27:10

标签: ios cocoa-touch ios7 ios6


我正在开发一个应用程序,如果他不再与服务器连接,我想断开用户的连接 我有类似的东西 使用导航控制器
创建登录 导航控制器
|
|
登录 - > ShowSomeInterface - >网页流量
   ^的 ___________________________ |
   |的 _____________________________ ^
视图随推送方式改变。

Login.m:

@interface ViewController ()

@end

@implementation ViewController

CGSize kbSize;

- (void)viewDidLoad {
    [super viewDidLoad];
    [[self navigationController] setNavigationBarHidden:YES animated:YES];  

    // manage the display of the keyboard.
    // it will be useful when the user will click on a field to manage the layout (It will move it) to have the better view possible
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:@"UIKeyboardWillShowNotification" object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidHide:) name:@"UIKeyboardDidHideNotification" object:nil];

}

- (BOOL) signin {
    if (![NetworkAvailable isNetworkAvailable]) {
        [self alertMessage:@"internet": @"NoConnection" :@"OK"];
        return NO;
    }
    if(  something   ) [self performSegueWithIdentifier:@"hasBeenDisconnected" sender:self];
    else [self performSegueWithIdentifier:@"login_success" sender:self];
    return YES;
}
@end

Login.h

#import <UIKit/UIKit.h>

@interface ChoiceViewController : UIViewController

@end

webview.m

@interface WebViewController () <UIWebViewDelegate>

@end

@implementation WebViewController

bool timeIsUp_Reconnection=NO;
NSTimer *timer;

- (void)viewDidLoad{
    [super viewDidLoad];

    [_webView setDelegate:self];

    [_webView loadRequest:[NSURLRequest requestWithURL: ... ]];

    [self launchTimer];
}

- (void)webViewDidStartLoad:(UIWebView *)webView{
    [super viewWillAppear:FALSE];
}

-(void) disconnectUser
{
    [self performSegueWithIdentifier:@"disconnectUser" sender:self];
}

@end

webview.h

#import <UIKit/UIKit.h>

@interface WebViewController : UIViewController <UIWebViewDelegate>

@property (strong, nonatomic) IBOutlet UIWebView *webView;

@end

当应用程序检测到用户已从服务器断开连接时,应用程序将启动登录界面以要求他重新登录。之后,应用程序将直接启动webview,并且不会启动其他界面(ShowSomeInterface) 这将是第一次工作。用户将被正确断开,但当服务器断开用户的另一次时,应用程序将不会再次启动登录界面。
这是我添加的用于更改视图的代码

[self performSegueWithIdentifier:@"disconnect" sender:self];

更改iOS视图是否错误?

0 个答案:

没有答案
相关问题