0

使用 Parse 框架,我试图让用户登录到应用程序,如果在用户按下登录按钮时登录有效,我希望改变视图。在这种特定情况下,如果(!错误)我希望切换视图。假设第二个视图称为 PostingViewController,我怎么能做到这一点?

-(IBAction)signUpButton:(id)sender
{
    NSString *userInput = usernameInputField.text;
    NSString *userPassword = passwordInputField.text;
    PFUser *user = [PFUser user];
    user.username = userInput;
    user.password = userPassword;
    [user signUpInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
        if(!error){ 

        }
        else{
            NSLog(@"there was a problem");
        }
    }];
}
4

1 回答 1

0

只需创建一个 PostingViewController 对象并将其推送到当前的 navigationController

类似的东西可能会有所帮助......

PostingViewController *vc = [[PostingViewController alloc] initWithNibName:@"your_nib_name" andBundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:vc withAnimation:YES];
[vc release];
于 2012-07-10T21:38:52.633 回答