2015-04-01 77 views
0

我对PFSignUpViewController进行了子类化,使其看起来与我的应用程序有点不同。我把它看起来像这样:解析自定义PFSignUpViewController没有响应

enter image description here

哪里这是从初始化的代码是:

if (![PFUser currentUser]) { // No user logged in 
     // Create the log in view controller 
     CustomSignUp *logInViewController = [[CustomSignUp alloc] init]; 
     [logInViewController setDelegate:self]; // Set ourselves as the delegate 

     // Create the sign up view controller 
     self.signUpViewController = [[TheActualSignUp alloc] init]; 
     [self.signUpViewController setDelegate:self]; // Set ourselves as the delegate 
     self.signUpViewController.fields = (PFSignUpFieldsUsernameAndPassword 
            | PFSignUpFieldsSignUpButton 
            | PFSignUpFieldsEmail 
            | PFSignUpFieldsAdditional 
            | PFSignUpFieldsDismissButton); 
     [self.signUpViewController.signUpView.additionalField setPlaceholder:@"First & Last Name"]; 
      /* UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; 
     [button addTarget:self 
        action:@selector(choosephoto) 
     forControlEvents:UIControlEventTouchUpInside]; 
     [button setImage:[UIImage imageNamed:@"Camera.png"] forState:UIControlStateNormal]; 
     button.frame = CGRectMake(160, 320, 50, 50); 
     [signUpViewController.view addSubview:button];*/ 
     // Assign our sign up controller to be displayed from the login controller 
     [logInViewController setSignUpController:self.signUpViewController]; 
     logInViewController.facebookPermissions = @[ @"email", @"public_profile", @"user_friends" ]; 
     logInViewController.fields = (PFLogInFieldsUsernameAndPassword 
            | PFLogInFieldsFacebook 
            | PFLogInFieldsTwitter 
            | PFLogInFieldsLogInButton 
            | PFLogInFieldsSignUpButton 
            | PFLogInFieldsPasswordForgotten); 

     // Present the log in view controller 

     [self presentViewController:logInViewController animated:YES completion:NULL]; 
    } 

但是,单击注册或dismissButtons什么也不做。直到我将Parse框架更新到1.7时,我才能正常工作。现在,注册中没有任何东西可以正常工作。我的子类的视图代码如下所示:

#import "TheActualSignUp.h" 


@implementation TheActualSignUp 

-(void)viewDidLoad { 
    self.view.backgroundColor = [UIColor blackColor]; 


      UIImageView *logoView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"[email protected]" ]]; 

      self.signUpView.logo = logoView; // logo can be any UIView 

      self.fieldsBackground = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"SignUpFieldBG.png"]]; 

      UITextView *iprayed = [[UITextView alloc] initWithFrame:CGRectMake(0, self.view.bounds.size.width - 235, self.view.bounds.size.width, 40)]; 

      iprayed.text = @"iPrayed 4 U Sign Up"; 

      iprayed.textAlignment = NSTextAlignmentCenter; 

      iprayed.textColor = [UIColor whiteColor]; 

      iprayed.backgroundColor = [UIColor blackColor]; 

      UIFont *cellFont = [UIFont fontWithName:@"Verdana-Bold" size:25]; 

      iprayed.font = cellFont; 


      [self.signUpView addSubview:iprayed]; 

     // [self.signUpView insertSubview:self.fieldsBackground atIndex:1]; 




} 
- (void)viewDidLayoutSubviews { 
    [super viewDidLayoutSubviews]; 

     CALayer * l = [self.signUpView.logo layer]; 
     [l setMasksToBounds:YES]; 
     [l setCornerRadius:(self.view.bounds.size.width - 250)/2]; 
     [l setBorderWidth:2.0]; 
     [l setBorderColor:[[UIColor whiteColor] CGColor]]; 

     // Set frame for elements 
     [self.signUpView.dismissButton setFrame:CGRectMake(10.0f, 10.0f, 87.5f, 45.5f)]; 
     [self.signUpView.logo setFrame:CGRectMake(125, 15, self.view.bounds.size.width - 250, self.view.bounds.size.width - 250)]; 

     [self.signUpView.signUpButton setFrame:CGRectMake(35.0f, self.view.bounds.size.width + 50, self.view.bounds.size.width - 70, 40.0f)]; 
     [self.signUpView.usernameField setFrame:CGRectMake(35.0f, self.view.bounds.size.width - 132, self.view.bounds.size.width - 70, 50.0f)]; 
     [self.signUpView.passwordField setFrame:CGRectMake(35.0f, self.view.bounds.size.width - 90, self.view.bounds.size.width - 70, 50.0f)]; 
     [self.signUpView.emailField setFrame:CGRectMake(35.0f, self.view.bounds.size.width - 48, self.view.bounds.size.width - 70, 50.0f)]; 
     [self.signUpView.additionalField setFrame:CGRectMake(35.0f, self.view.bounds.size.width - 6, self.view.bounds.size.width - 70, 50.0f)]; 
     [self.fieldsBackground setFrame:CGRectMake(35.0f, self.view.bounds.size.width - 135, self.view.bounds.size.width - 70, 174.0f)]; 


} 

@end 

回答

0

,如果你这样做,在viewDidLayoutSubviews,你将是一个无限循环,因为这些方法使得用户界面的改变,并再次呼吁viewDidLayoutSubviews