로그인 폼에 delegate
회원을 신고하지 않은 것 같습니다. LoginForm이 완료되면 LoginForm을 모달로 표시하는 UIViewController 인스턴스를 사용할 수 있도록 코드를 추가해야합니다. LoginForm.h에서
: LoginForm.m에서
@class LoginForm;
@protocol LoginFormDelegate
- (void)loginFormDidFinish:(LoginForm*)loginForm;
@end
@interface LoginForm {
// ... all your other members ...
id<LoginFormDelegate> delegate;
}
// ... all your other methods and properties ...
@property (retain) id<LoginFormDelegate> delegate;
@end
: 여기에 자신의 위임을 선언하는 방법은 LoginForm을 제시의 UIViewController 인스턴스에 다음
@implementation
@synthesize delegate;
//... the rest of LoginForm's implementation ...
@end
을 (의가 MyViewController 호출하자) :
In MyViewController.h :
@interface MyViewController : UIViewController <LoginFormDelegate>
@end
MyViewController.m에서 6,
:
/**
* LoginFormDelegate implementation
*/
- (void)loginFormDidFinish:(LoginForm*)loginForm {
// do whatever, then
// hide the modal view
[self dismissModalViewControllerAnimated:YES];
// clean up
[loginForm release];
}
- (IBAction)showLogin:(id)sender {
LoginForm *lf = [[LoginForm alloc]initWithNibName:@"LoginForm" bundle:nil];
lf.delegate = self;
lf.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:lf animated:YES];
}
나는 ViewBased 응용 프로그램에 동일한 코드를 사용하는 경우 내가 두 번째 줄에서 동일한 오류가 발생하지만, 내가 선을 제거하면 내가 버튼을 누를 때 모달 뷰가 나타납니다. 대표단에게 특별한 것이 필요합니까? 탭이있는 템플릿의 경우? – irco