2014-05-15 2 views
0

그래서 사용자가 비밀번호를 복구하고자 할 때 버튼을 누르면 서브 뷰는 UITextFieldUIButton으로 나타납니다. 사용자가 전자 메일을 입력 한 후 UIButton에 전자 메일을 보내려고합니다.Parse.com에서 비밀번호를 재설정하는 방법은 무엇입니까?

- (IBAction)recoverPassword:(id)sender { 

CGRect frame = CGRectMake(12, 51, 298, 497); 

UIView *infoView = [[UIView alloc] initWithFrame:frame]; 
infoView.opaque = NO; 
infoView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.8f]; 
infoView.userInteractionEnabled = YES; 
infoView.tag = 01; 

UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(8, 200, 280, 30)]; 
textField.textAlignment = NSTextAlignmentLeft; 
textField.textColor = [UIColor blackColor]; 

UIButton *getPassword = [[UIButton alloc] initWithFrame:CGRectMake(8, 265, 280, 36)]; 
getPassword.backgroundColor = [UIColor blackColor]; 

[getPassword addTarget:self 
       action:@selector(getUserPassword:) 
    forControlEvents:UIControlEventTouchUpInside]; 

[infoView addSubview:textField]; 
[infoView addSubview:getPassword]; 
[self.view addSubview:infoView]; 

} 

- (void)getUserPassword:(UITapGestureRecognizer *)sendPassword { 

[PFUser requestPasswordResetForEmailInBackground:**Missing Part**]; 
[[self.view viewWithTag:01] removeFromSuperview]; 
NSLog(@"Dissmissed Info SubView"); 
} 

답변

0

당신이 (메소드 범위 내에서) 로컬 범위에 대한 파단 (UITextField에,있는 UIButton 등)을 만드는 것 같습니다가, 따라서 그들이 원 ': 나는 여기에 UITextField에 추천을 잃었 나의 코드입니다 동일한 클래스의 다른 메소드에 액세스 할 수 있어야합니다. 이러한 메소드가있는 클래스의 ivar을 만들고 ivar에 값을 할당하면 -getUserPassword: 메소드에서 동일한 변수에 액세스 할 수 있습니다.

P. 같은 방법이지만 infoView에 적용하면 viewWithTag을 통해 액세스 할 필요가 없으므로 직접 액세스 할 수 있습니다.

관련 문제