0

I am getting UIViewControllerHierarchyInconsistency exception when assigning,

txtFieldDelegate.view = self.view;  
txtFirstName.delegate = txtFieldDelegate;
txtLastName.delegate = txtFieldDelegate;

I am having text field delegate methods in some other class and creating objects for the text field delegate class to use the same. Please provide suggestions to resolve this..

4

2 回答 2

1

This view controller was inheriting a class which inherits UIViewController. The inherited class's inheritance is changed as NSObject. Instead of TheClass: UIViewController, it was changed as TheClass:NSObject

于 2012-11-07T09:07:08.450 回答
0

尝试这个:

SomeOtherClassViewController *txtFieldDelegateVC = [[SomeOtherClassViewController alloc] init]; 
txtFirstName.delegate = txtFieldDelegateVC;
txtLastName.delegate = txtFieldDelegateVC;
于 2012-09-24T09:42:07.950 回答