簡體   English   中英

以編程方式執行故事板Segue

[英]Performing a Storyboard Segue programmatically

我是大家,我正在為新的應用程序開發登錄和密碼界面,我想有條件地執行一個segue,只有當密碼和登錄都沒問題時。 我在故事板中使用“推送”樣式和“loginMainIdentifier”創建了一個Segue。 實現文件夾的編寫如下:

    - (IBAction)pushValidateButton:(id)sender {

    if([loginText.text isEqualToString:@""] || [passwordText.text isEqualToString:@""] )
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Identification" message:@"Veuillez completer l'ensemble des cases SVP" delegate:self cancelButtonTitle:@"Revenir" otherButtonTitles:nil];
        alert.alertViewStyle = UIAlertViewStyleDefault;
        [alert show];
    }

    if(![loginText.text isEqualToString:@""] && ![passwordText.text isEqualToString:@""])
    {
    //creation of the request
        NSMutableString *string = [[NSMutableString alloc] initWithCapacity:100];
        NSString *string01 = @"http://89.82.227.112/Vico/login.php?l=&m="; 


        [string appendFormat:string01];
        NSString *string02 = loginText.text;
        NSString *string03 = passwordText.text;

        [string insertString:string03 atIndex:41];
        [string insertString:string02 atIndex:38];

        NSURLRequest *request01=[NSURLRequest requestWithURL:[NSURL URLWithString:string]cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];

    //create the connection and start loading data

        NSURLConnection *connection01 = [[NSURLConnection alloc] initWithRequest:request01 delegate:self];
        if(connection01)
        {
        //Create NSMutableData to receive data
        //receiveddata is an instance declared elsewhere
        receivedData = [NSMutableData data];
        }
    }
    [self performSegueWithIdentifier:@"loginMainSegue" sender:self];
}

我不明白為什么它不能與代碼末尾的[self performSegueWithIdentifier:@"loginMainSegue" sender:self]一起使用。

是否有人知道只有在登錄和文本填寫時才能執行segue所缺少的內容。

謝謝

勝利者

檢查名稱拼寫正確(你在代碼之上loginMainIdentifier寫,然后loginMainSegue)。

還要檢查這個segue是否從整個 viewController連接到目標viewController。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM