2015-01-06 2 views
0

사용자가 가입 할 때 구문 분석을 사용하는 응용 프로그램에 프로필 그림을 추가하고 싶지만 이렇게하려면 새로운 ViewController를 만들고 싶지 않습니다. 모든 필드가 완료 될 때까지그림을 선택하기 전까지 구문 분석을 완료하지 마십시오

- (BOOL)signUpViewController:(PFSignUpViewController *)signUpController shouldBeginSignUp:(NSDictionary *)info { 

    BOOL informationComplete = YES; 
    // loop through all of the submitted data 
    for (id key in info) { 
     NSString *field = [info objectForKey:key]; 
     if (!field || field.length == 0 || ![signUpController.signUpView.additionalField.text containsString:@" "]) { // check completion 
      informationComplete = NO; 
      break; 
     } 


    } 

    // Display an alert if a field wasn't completed 
    if (!informationComplete) { 
     [[[UIAlertView alloc] initWithTitle:@"Missing Information" 
            message:@"Make sure you fill out all of the information, including first & last name!" 
            delegate:nil 
          cancelButtonTitle:@"ok" 
          otherButtonTitles:nil] show]; 
    } 

    return informationComplete; 

} 

이 가입 절차를 떠받됩니다 shouldBeginSignUp에 대한 대리자, 나는 기본이있다. 가입을 클릭하면 프로필 사진을 선택하거나 새로운 사진을 찍으라는 메시지가 UIActionSheet 팝업으로 표시됩니다. 사진이 찍히면 PFUser에 추가됩니다. 이 일을 어떻게 제안 하시겠습니까?

+0

어디서 붙어 있습니까? –

+0

그림이 선택되지 않은 경우 false를 반환하고 UIImagePickerController (https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UIImagePickerController_Class/index.html)를 읽습니다. – danh

답변

0

사용자가 저장 한 후에야 테스트 할 필요가있을 때까지 사용자 정의 파일/참조를 설정할 수 있다고 확신 할 수는 없지만 항상 위임 메서드에서 no를 반환해야합니다.

유효성 검사가 통과되면 여전히 NO를 반환하지만 이미지 선택을 위해 트리거합니다. 이미지가 선택되면 모든 것을 닫고 PFUser을 사용하여 수동으로 가입 프로세스를 완료하십시오 (수동으로 사용자를 생성하고 가입 컨트롤러 필드를 반복하여 사용자 선택 항목으로 채워야 할 수도 있음).