【代码笔记】iOS-获得当前的月的天数

一,代码。

【代码笔记】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
【代码笔记】iOS-获得当前的月的天数

二,输出。

2015-10-19 13:33:04.785 获得当前的月的天数[5116:115173] 8月的天数31
 
 
上一篇:Spring学习 6- Spring MVC (Spring MVC原理及配置详解)


下一篇:Spring MVC之@RequestBody@ResponseBody详解