I'd like to play around with attribute value validation, but the documentation is pretty empty on this. Maybe there's an good article or tutorial 开发者_StackOverflow中文版out there?
Here is a fairly common validation to ensure you don't get nonsensical dates put into a timeStamp.
- (BOOL)validateTimeStamp:(id *)valueRef error:(NSError **)outError
{
NSDate *testDate=(NSDate *) valueRef;
if ([testDate compare:self.minimumTimeStamp]==NSOrderedAscending) {
// generate and return error so you can set a proper date
}
return YES;
}
精彩评论