Hi,
I have a pretty major problem, basically i have a XIB which I am loading in, which contains a number of UIControls. I programatically add some UITextFields to the view of the UIViewController which loads the XIB. I then "close" the view, which deallocs the owning UIViewControler, then re-launch it and when i interact with the UITextFields on the view, theyre pointing to the OLD UITextFields, not the ones i just created when i re-launched the view.
This is causing me a pretty major problem in that I have drag/drop controls which can be added to the UITextFields and on the "drop" of the draggable object on the UITextField, the dropped object is being added to the OLD UITextField, not the one I just created in the viewDidLoad.
I have been working on this for ages now and I am really stumped.
Could the UIViewController's view be being cached somehow and the UITextFields along with it?
I have done a check to see if any UITextFields exist in the viewDidLoad by:
Code:
int cnt = 0;
for(int i = 0; i < [self.view.subviews count]; i++){
if([[self.view.subviews objectAtIndex:i] isKindOfClass:[UITextField class]])
cnt++
}
and the cnt var is always 0...
I just don't understand why the old UITextFields are receiving the events?
In my UIViewController's dealloc method, i release each of the UITextFields, but when i run the app "normally" i.e. not debugging through XCode, the app crashes in the dealloc. When debugging, this crash doesn't occur and the NEW UITextFields do receive the dropped object, but I cant fathom as to why its crashing in dealloc when its run normally, but not when debugging? The object's retainCount should be the same in either scenario...
Any suggestions appreciated.
Mike