我有问题,当我打开应用程序时,我可以看到最新结果,当我向左滑动 uiview 时,我可以看到以前的结果,我面临的问题是我想向右滑动以再次获得最新结果。
这是向左滑动的代码
-(void)swipeLeft
{
NSLog(@"Mag Date:%@",magCurDate);
NSDate *tempDate;
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"dd/MM/yyyy"];
tempDate = [formatter dateFromString:magCurDate];
NSLog(@"temp Date:%@",tempDate);
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *dateComponents = [[NSDateComponents alloc] init];
[dateComponents setDay:-1];
[dateComponents setHour:8];
NSDate *targetDate = [gregorian dateByAddingComponents:dateComponents toDate:tempDate options:0];
NSLog(@"target Date:%@",targetDate);
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"ddMMYYYY"];
NSString *sDate = [df stringFromDate:targetDate];
NSLog(@"sDate Date:%@",sDate);
[self LoadMagnumResult:sDate];
}
这是我向右滑动的代码,但我无法停止最新的结果,我希望最后一次滑动是最新的结果。
-(void)swipeRight
{
NSLog(@"Mag Date:%@",magCurDate);
NSDate *tempDate;
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"dd/MM/yyyy"];
tempDate = [formatter dateFromString:magCurDate];
NSLog(@"temp Date:%@",tempDate);
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *dateComponents = [[NSDateComponents alloc] init];
[dateComponents setDay:+1];
[dateComponents setHour:8];
NSDate *targetDate = [gregorian dateByAddingComponents:dateComponents toDate:tempDate options:0];
NSLog(@"target Date:%@",targetDate);
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"ddMMYYYY"];
NSString *sDate = [df stringFromDate:targetDate];
NSLog(@"sDate Date:%@",sDate);
[self LoadMagnumResult:sDate];
}