How do I compare the id argument to an IBAction, to a instance pointer?
IBOutlet UITextField * tw1;
IBOutlet UITextField * tw2;
the == doesn’t look to work:
- (IBAction) editingDidEnd:(id) sender
{
if (sender == tw1) {
...
}
if (sender == two) {
...
}
}
id is something like (void*), so the comparison of these two pointers should yield true, because both point to the same spot, but it doesn’t.
In this line:
(sender == two), “two” is not “tw2”. If that’s not a typo in your question, it’s a bug in your program.If the typo isn’t the problem, something probably isn’t connected the way you think it is. Add these lines to see what’s going on:
If tw1 and tw2 are 0, you don’t have them connected in Interface Builder.