• 领取招财币,第二天,


    //点击(button)领取的时间,

    -(void)receiveCoin

    {

        self.coinStateLabel.text = @"招财币已领取";

        self.coinBtn.userInteractionEnabled = NO;

        NSDate *now = [NSDate new];

        unsigned units  = NSMonthCalendarUnit|NSDayCalendarUnit|NSYearCalendarUnit;

        NSCalendar *mCal = [[NSCalendaralloc] initWithCalendarIdentifier:NSGregorianCalendar];

        NSDateComponents *mComp = [mCal components:units fromDate:now];

        NSDate *mDate = [mCal dateFromComponents:mComp];

        NSTimeInterval timeInterval = [mDate timeIntervalSince1970];

        NSUserDefaults *dateDefault = [NSUserDefaultsstandardUserDefaults];

        [dateDefault setValue:[NSString stringWithFormat:@"%f",timeInterval] forKey:@"dateFlag"];

     }

     

     

    //进入页面的时间

    -(BOOL)isReceiveCoin

    {

        NSDate *now = [NSDate new];

        unsigned units  = NSMonthCalendarUnit|NSDayCalendarUnit|NSYearCalendarUnit;

        NSCalendar *mCal = [[NSCalendaralloc] initWithCalendarIdentifier:NSGregorianCalendar];

        NSDateComponents *mComp = [mCal components:units fromDate:now];

        NSDate *mDate = [mCal dateFromComponents:mComp];

        NSTimeInterval timeInterval = [mDate timeIntervalSince1970];

        

        NSUserDefaults *dateDefault = [NSUserDefaultsstandardUserDefaults];

        float mInterval = [[dateDefault valueForKey:@"dateFlag"]floatValue];

        

        if(timeInterval - mInterval >= 24 * 60 * 60 - 1){

            return NO;

        }else{

            return YES;

        }

     

    }

  • 相关阅读:
    oracle 11g 执行先决条件检查失败的解决方法
    Oracle 11g 详细安装步骤
    Github的使用
    Git的配置与基本操作
    Git安装教程(windows)
    robot framework 自动化框架环境搭建
    Windows下jenkins环境搭建
    Windows 下搭建 SVN服务器
    fiddler配置及使用教程
    逆序链表
  • 原文地址:https://www.cnblogs.com/guligei/p/3389121.html
Copyright © 2020-2023  润新知