资源简介
教你怎么制作日历,自动获取当天的时间并选中为红色,点击日历上的日期出现弹窗年月日,并把选中的标记为黄色,向左向上月份自动变为下个月,向下向右月份变为上个月,自动切换年份,切换动画为波纹效果

代码片段和文件信息
//
// baseVC.m
// liwei_calendar(日历)
//
// Created by kouclo on 15/7/31.
// Copyright (c) 2015年 kouclo. All rights reserved.
//
#import “baseVC.h“
@interface baseVC ()
@end
@implementation baseVC
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/// 将国际时间转换为北京时间
- (NSDate *)getNowDateFromatAnDate:(NSDate *)anyDate
{
//设置源日期时区
NSTimeZone* sourceTimeZone = [NSTimeZone timeZoneWithAbbreviation:@“GMT“];//或GMT
//设置转换后的目标日期时区
NSTimeZone* destinationTimeZone = [NSTimeZone localTimeZone];
//得到源日期与世界标准时间的偏移量
NSInteger sourceGMTOffset = [sourceTimeZone secondsFromGMTForDate:anyDate];
//目标日期与本地时区的偏移量
NSInteger destinationGMTOffset = [destinationTimeZone secondsFromGMTForDate:anyDate];
//得到时间偏移量的差值
NSTimeInterval interval = destinationGMTOffset - sourceGMTOffset;
//转为现在时间
NSDate* destinationDateNow = [[NSDate alloc] initWithTimeInterval:interval sinceDate:anyDate];
return destinationDateNow;
}
/// 计算某一年某个月有多少天
-(int)howManyDaysInThisMonth:(int)year month:(int)imonth {
if((imonth == 1)||(imonth == 3)||(imonth == 5)||(imonth == 7)||(imonth == 8)||(imonth == 10)||(imonth == 12))
return 31;
if((imonth == 4)||(imonth == 6)||(imonth == 9)||(imonth == 11))
return 30;
if((year%4 == 1)||(year%4 == 2)||(year%4 == 3))
{
return 28;
}
if(year%400 == 0)
return 29;
if(year%100 == 0)
return 28;
return 29;
};
///根据日期获取星期
- (NSString*)weekdayStringFromDate:(NSDate*)inputDate {
NSArray *weekdays = [NSArray arrayWithobjects: [NSNull null] @“周日“ @“周一“ @“周二“ @“周三“ @“周四“ @“周五“ @“周六“ nil];
NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSTimeZone *timeZone = [[NSTimeZone alloc] initWithName:@“Asia/Shanghai“];
[calendar setTimeZone: timeZone];
NSCalendarUnit calendarUnit = NSWeekdayCalendarUnit;
NSDateComponents *theComponents = [calendar components:calendarUnit fromDate:inputDate];
return [weekdays objectAtIndex:theComponents.weekday];
}
@end
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2015-07-31 09:32 liwei_calendar(鏃ュ巻)\
文件 6148 2015-07-31 18:26 liwei_calendar(鏃ュ巻)\.DS_Store
目录 0 2015-08-03 09:54 __MACOSX\
目录 0 2015-08-03 09:54 __MACOSX\liwei_calendar(鏃ュ巻)\
文件 120 2015-07-31 18:26 __MACOSX\liwei_calendar(鏃ュ巻)\._.DS_Store
目录 0 2015-08-03 09:49 liwei_calendar(鏃ュ巻)\liwei_calendar(鏃ュ巻)\
文件 2151 2015-07-30 17:17 liwei_calendar(鏃ュ巻)\liwei_calendar(鏃ュ巻)\AppDelegate.swift
目录 0 2015-08-03 09:54 __MACOSX\liwei_calendar(鏃ュ巻)\liwei_calendar(鏃ュ巻)\
文件 171 2015-07-30 17:17 __MACOSX\liwei_calendar(鏃ュ巻)\liwei_calendar(鏃ュ巻)\._AppDelegate.swift
目录 0 2015-07-30 17:17 liwei_calendar(鏃ュ巻)\liwei_calendar(鏃ュ巻)\ba
文件 3716 2015-07-30 17:17 liwei_calendar(鏃ュ巻)\liwei_calendar(鏃ュ巻)\ba
目录 0 2015-08-03 09:54 __MACOSX\liwei_calendar(鏃ュ巻)\liwei_calendar(鏃ュ巻)\ba
文件 171 2015-07-30 17:17 __MACOSX\liwei_calendar(鏃ュ巻)\liwei_calendar(鏃ュ巻)\ba
文件 1580 2015-07-30 17:17 liwei_calendar(鏃ュ巻)\liwei_calendar(鏃ュ巻)\ba
文件 171 2015-07-30 17:17 __MACOSX\liwei_calendar(鏃ュ巻)\liwei_calendar(鏃ュ巻)\ba
文件 488 2015-07-31 16:29 liwei_calendar(鏃ュ巻)\liwei_calendar(鏃ュ巻)\ba
文件 171 2015-07-31 16:29 __MACOSX\liwei_calendar(鏃ュ巻)\liwei_calendar(鏃ュ巻)\._ba
文件 2524 2015-07-31 16:32 liwei_calendar(鏃ュ巻)\liwei_calendar(鏃ュ巻)\ba
文件 171 2015-07-31 16:32 __MACOSX\liwei_calendar(鏃ュ巻)\liwei_calendar(鏃ュ巻)\._ba
文件 9047 2015-08-03 09:49 liwei_calendar(鏃ュ巻)\liwei_calendar(鏃ュ巻)\CalendarVC.swift
文件 171 2015-08-03 09:49 __MACOSX\liwei_calendar(鏃ュ巻)\liwei_calendar(鏃ュ巻)\._CalendarVC.swift
目录 0 2015-07-31 14:50 liwei_calendar(鏃ュ巻)\liwei_calendar(鏃ュ巻)\Images.xcassets\
目录 0 2015-07-30 17:17 liwei_calendar(鏃ュ巻)\liwei_calendar(鏃ュ巻)\Images.xcassets\AppIcon.appiconset\
文件 585 2015-07-30 17:17 liwei_calendar(鏃ュ巻)\liwei_calendar(鏃ュ巻)\Images.xcassets\AppIcon.appiconset\Contents.json
目录 0 2015-08-03 09:54 __MACOSX\liwei_calendar(鏃ュ巻)\liwei_calendar(鏃ュ巻)\Images.xcassets\
目录 0 2015-08-03 09:54 __MACOSX\liwei_calendar(鏃ュ巻)\liwei_calendar(鏃ュ巻)\Images.xcassets\AppIcon.appiconset\
文件 171 2015-07-30 17:17 __MACOSX\liwei_calendar(鏃ュ巻)\liwei_calendar(鏃ュ巻)\Images.xcassets\AppIcon.appiconset\._Contents.json
目录 0 2015-07-31 14:50 liwei_calendar(鏃ュ巻)\liwei_calendar(鏃ュ巻)\Images.xcassets\calendar_default_bg.imageset\
文件 15686 2015-07-31 14:50 liwei_calendar(鏃ュ巻)\liwei_calendar(鏃ュ巻)\Images.xcassets\calendar_default_bg.imageset\calendar_default_bg@2x.png
文件 319 2015-07-31 14:50 liwei_calendar(鏃ュ巻)\liwei_calendar(鏃ュ巻)\Images.xcassets\calendar_default_bg.imageset\Contents.json
目录 0 2015-07-31 14:50 liwei_calendar(鏃ュ巻)\liwei_calendar(鏃ュ巻)\Images.xcassets\calendar_item_bg.imageset\
............此处省略30个文件信息
- 上一篇:IDL语言Modis数据建立查找表
- 下一篇:Delphi Https-Post
相关资源
- swift-swift版本的简易WKWebview浏览器带加
- swift-模仿类似聊天的UI
- TLssCalendar (支持农历的月历控件)
- iOS Swift简单Demo
- Core Data by Tutorials (Swift 4.2)
- OSS图片上传 swift
- Qt 日历可显示阴历生宵和时钟基于Q
- 基于swift结合uiview做的一个app
- 小码哥Swift5.0完整版视频教程
- swift-一行代码画一个表格UIView分类可
- AppCode,新书推荐,Beginning iOS 11 Prog
- Desgin Patterns by Tutorials v1.0 (Swift 4 &
- swift进阶全部格式集合最新第四版
- swift-PSImageEditors一个简而至美的图片编
- swift-通讯录最简单的中英文混合排序
-
swift-iOS平台下基于IJKpla
yer封装的视 - swift-iOS编写的日历模仿大姨妈app中的
- ios-swift纯代码精仿拼多多.zip
-
swift-YLFollowMusicPla
yer一个在线音乐播 - ios-swift 版 俄罗斯方块.zip
- ios-Swift多国语言本地切换方法升级S
- 高清彩版 Ray Wenderlich Advanced-Swift-4.0
- 日历控件calendarViewDemo
- 函数式swift 函数式编程中文版高清p
- Beginning Swift Master the fundamentals of pro
- swift4.0进阶
- objccn-app-architecture,pdf epub mobi App架构
- 函数式Swift4-最新版
- Swift语言实战晋级-课件代码源文件(
- Objc中国--函数式Swift4.0版本
评论
共有 条评论