In the past few hours that my beta testers have had a look at Dayta, they’ve already found a ton of stuff that needs fixing. Awesome.
One of these things is the fact that I allow data logs to be added even when there’s no name. I can’t believe I forgot to check for this. Anyways, this is how you do it:
Set up a method that responds to whenever a textField gets changed:
[myTextField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
Then just create the textFieldDidChange: method, like so:
-(void)textFieldDidChange:(id)sender {
if ([[sender text] length] == 0)
{
self.navigationItem.rightBarButtonItem.enabled = NO;
} else {
self.navigationItem.rightBarButtonItem.enabled = YES;
}
}
And you’re done.
