0
我在需要呈現模態的導航控制器內部有一個ViewController。Objective-C:代表在導航控制器中的模態爲零
的視圖控制器具有此作爲其頭:
@interface ViewController : BaseViewController<AuthenticateDelegate>
,並在IBAction爲呈現模態:
AuthenticationController *authVC = [self.storyboard instantiateViewControllerWithIdentifier:@"AuthControllerView"];
authVC.delegate = self;
[self presentModalViewController:authVC animated:YES];
的AuthenticationController有這個在.h文件中:
@interface AuthenticationController: BaseViewController<UITextFieldDelegate>
@property (nonatomic, assign) id <AuthenticateDelegate> delegate;
@end
正如您所看到的,我已將「self」(ViewController)作爲委託給A uthenticationController,但由於某種原因,代表處在:
- (IBAction)SubmitAuthentication:(id)sender;
{
[self.delegate validateUser:lblUsername.text :lblPassword.text];
[self dismissModalViewControllerAnimated:YES];
}
任何幫助將不勝感激。
代表通常應該保存爲弱屬性http://stackoverflow.com/questions/8449040/why-use-weak-pointer-for-delegation – vikingosegundo