[Code Note] compares two time strings and notes strings.
I ,.
Ii. Code.
-(Void) viewDidLoad {[super viewDidLoad]; // Do any additional setup after loading the view. [self initTimerCompare] ;}# pragma-mark-functions // comparison time-(void) initTimerCompare {NSString * starTimer = @ "2014-08-29"; NSString * finishTimer = "; BOOL result = [starTimer compare: finishTimer] = NSOrderedSame; NSLog (@ "result: % d", result); if (result = 1) {UIAlertView * alert = [[UIAlertView alloc] initWithTitle: nil message: @ "the start time and end time are equal" delegate: self cancelButtonTitle: @ "I know" otherButtonTitles: nil, nil]; [alert show]; return;} BOOL result1 = [starTimer compare: finishTimer] = NSOrderedDescending; NSLog (@ "result1: % d", result1 ); if (result1 = 1) {UIAlertView * alert = [[UIAlertView alloc] initWithTitle: nil message: @ "Start time later than end time" delegate: self cancelButtonTitle: @ "understand" otherButtonTitles: nil, nil]; [alert show]; return;} BOOL result2 = [starTimer compare: finishTimer] = NSOrderedAscending; NSLog (@ "result2: % d ", result1); if (result2 = 1) {UIAlertView * alert = [[UIAlertView alloc] initWithTitle: nil message: @" Start time earlier than end time "delegate: self cancelButtonTitle: @ "know" otherButtonTitles: nil, nil]; [alert show]; return ;}}