zoukankan      html  css  js  c++  java
  • 【代码笔记】iOS-获得当前的月的天数

    一,代码。

    复制代码
    #import "ViewController.h"
    
    @interface ViewController ()
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
        [super viewDidLoad];
        // Do any additional setup after loading the view, typically from a nib.
        
        NSLog(@"8月的天数%ld",(long)[self getCurrentDay:8]);
        
    }
    #pragma -mark -functions
    //获得当前的月的天数
    -(NSInteger )getCurrentDay:(int) currentMonth{
        if (currentMonth < 8 ) {
            if (currentMonth %2 ==1) {
                return 31;
            }else{
                return 30;
            }
        }else{
            if (currentMonth %2 ==1) {
                return 30;
            }else{
                return 31;
            }
        }
        
    }
    
    
    - (void)didReceiveMemoryWarning {
        [super didReceiveMemoryWarning];
        // Dispose of any resources that can be recreated.
    }
    
    @end
    复制代码

     

    二,输出。

    2015-10-19 13:33:04.785 获得当前的月的天数[5116:115173] 8月的天数31

     

     

     
     
  • 相关阅读:
    4.8日学习
    Apache安装
    HTML5 review
    个人阅读作业LAST
    个人阅读作业Week7
    结对编程:界面模块总结
    个人博客作业Week3
    结对编程博客
    个人博客week2
    软工第一次作业简单总结
  • 原文地址:https://www.cnblogs.com/yang-guang-girl/p/5304766.html
Copyright © 2011-2022 走看看