- 浏览: 38672 次
文章分类
最新评论
-
peng13123:
...
Hibernate4+Spring3+SpringMVC -
peng13123:
好吧,呵呵zxxwlj 写道 翻/墙?违法。。。
我想问为啥我goagent的文章被删除了 -
zxxwlj:
翻/墙?违法。。。
我想问为啥我goagent的文章被删除了
h
{
NSDate *choseDate;//显示日期
NSDateFormatter *df;//时间格式化
NSCalendar*calendar;//日历
NSDateComponents*comps;//
}
@property (weak, nonatomic) IBOutlet UIButton *dateL;
@property (weak, nonatomic) IBOutlet UIButton *beforeBtn;
@property (weak, nonatomic) IBOutlet UIButton *nextBtn;
m
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
df = [[NSDateFormatter alloc]init];
[df setDateFormat:@"yyy-MM-dd"];
calendar = [NSCalendar currentCalendar];
[self _initCDate:[NSDate date]];
[_beforeBtn addTarget:self action:@selector(beforeAc) forControlEvents:UIControlEventTouchUpInside];
[_nextBtn addTarget:self action:@selector(nextAc) forControlEvents:UIControlEventTouchUpInside];
}
#pragma maek date
-(void)_initCDate:(NSDate *)_nsdate{
choseDate=_nsdate;
comps =[calendar components:(NSWeekCalendarUnit | NSWeekdayCalendarUnit |NSWeekdayOrdinalCalendarUnit)fromDate:choseDate];
NSInteger weekday = [comps weekday]; // 星期几(注意,周日是“1”,周一2………………)
NSString *wdS ;
switch (weekday) {
case 1:
wdS=@"日";
break;
case 2:
wdS=@"一";
break;
case 3:
wdS=@"二";
break;
case 4:
wdS=@"三";
break;
case 5:
wdS=@"四";
break;
case 6:
wdS=@"五";
break;
case 7:
wdS=@"六";
break;
default:
break;
}
NSString *date_= [df stringFromDate:choseDate];
[_dateL setTitle:[NSString stringWithFormat:@" %@ 星期%@ ",date_,wdS] forState:UIControlStateNormal];
_dateL.userInteractionEnabled=NO;
}
#pragma mark 前一天Ac
-(void)beforeAc{
choseDate=[[NSDate alloc]initWithTimeIntervalSinceReferenceDate:([choseDate timeIntervalSinceReferenceDate]-24*3600)];
[self _initCDate:choseDate];
}
#pragma mark 后一天Ac
-(void)nextAc{
choseDate=[[NSDate alloc]initWithTimeIntervalSinceReferenceDate:([choseDate timeIntervalSinceReferenceDate]+24*3600)];
[self _initCDate:choseDate];
}
{
NSDate *choseDate;//显示日期
NSDateFormatter *df;//时间格式化
NSCalendar*calendar;//日历
NSDateComponents*comps;//
}
@property (weak, nonatomic) IBOutlet UIButton *dateL;
@property (weak, nonatomic) IBOutlet UIButton *beforeBtn;
@property (weak, nonatomic) IBOutlet UIButton *nextBtn;
m
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
df = [[NSDateFormatter alloc]init];
[df setDateFormat:@"yyy-MM-dd"];
calendar = [NSCalendar currentCalendar];
[self _initCDate:[NSDate date]];
[_beforeBtn addTarget:self action:@selector(beforeAc) forControlEvents:UIControlEventTouchUpInside];
[_nextBtn addTarget:self action:@selector(nextAc) forControlEvents:UIControlEventTouchUpInside];
}
#pragma maek date
-(void)_initCDate:(NSDate *)_nsdate{
choseDate=_nsdate;
comps =[calendar components:(NSWeekCalendarUnit | NSWeekdayCalendarUnit |NSWeekdayOrdinalCalendarUnit)fromDate:choseDate];
NSInteger weekday = [comps weekday]; // 星期几(注意,周日是“1”,周一2………………)
NSString *wdS ;
switch (weekday) {
case 1:
wdS=@"日";
break;
case 2:
wdS=@"一";
break;
case 3:
wdS=@"二";
break;
case 4:
wdS=@"三";
break;
case 5:
wdS=@"四";
break;
case 6:
wdS=@"五";
break;
case 7:
wdS=@"六";
break;
default:
break;
}
NSString *date_= [df stringFromDate:choseDate];
[_dateL setTitle:[NSString stringWithFormat:@" %@ 星期%@ ",date_,wdS] forState:UIControlStateNormal];
_dateL.userInteractionEnabled=NO;
}
#pragma mark 前一天Ac
-(void)beforeAc{
choseDate=[[NSDate alloc]initWithTimeIntervalSinceReferenceDate:([choseDate timeIntervalSinceReferenceDate]-24*3600)];
[self _initCDate:choseDate];
}
#pragma mark 后一天Ac
-(void)nextAc{
choseDate=[[NSDate alloc]initWithTimeIntervalSinceReferenceDate:([choseDate timeIntervalSinceReferenceDate]+24*3600)];
[self _initCDate:choseDate];
}
发表评论
-
Xcode7 ios9不能用http请求
2015-09-17 18:49 625Xcode7 使用NSURLSession发送HTTP请求的问 ... -
iOS UITableViewCell 中 调整imageView 的图片大小
2015-08-26 16:10 1295//设置图片 [cell.imageView setImage ... -
[转]iOS 万能跳转界面方法 (runtime实用篇一)
2015-08-24 10:27 538在开发项目中,会有这样变态的需求: 推送:根据服务端推送过来 ... -
周堋斐:梦想的开发者
2015-04-13 17:56 012年的深圳软件园也是各种。呵呵哒 -
IOS判断app在appstore是否有可用的更新
2015-03-13 10:25 494iTunes可以提供app的版本信息,主要通过appid获取, ... -
uitableview分割线 左右边距相同
2015-01-21 15:59 2482_myTableView1.separatorInset= ... -
在uiimageview中设置网络图片等比例大小
2014-12-30 15:38 688NSData *data=[NSData dataWith ... -
[转]iOS UISCrollView循环滚动 实现
2014-12-30 13:42 646google了半天发现很多人竟然搞不定,甚至还有人用数组左移右 ... -
push的时候,感觉上一个页面的视图还有残留,然后停顿了一下,才消失的解决
2014-12-10 20:04 1799这个,以前遇到过,后来不知怎么弄好了,现在就是你如果改下pus ... -
view整体上移
2014-11-26 16:06 732如果你准备将你的老的 iOS 6 app 迁移到 iOS 7/ ... -
广告轮播
2014-11-17 20:05 429h <UIAlertViewDelegate,UIScr ... -
设置全局navigation barbuttonitem
2014-11-17 19:58 692#pragma mark 设置全局navigation bar ... -
sdwebimage ios8 报错
2014-11-02 00:22 612报错:Use of undeclared identifier ... -
之前有人整理过Git上好用的iOS库,我搬运一下
2014-10-31 14:56 277之前有人整理过Git上好用的iOS库,我搬运一下: http: ... -
ios中添加和移除view
2014-08-14 11:36 786la = [[UILabel alloc]init]; ... -
UITextField只能输入数字且小数点后保留2位
2014-07-18 17:17 525#pragma mark UITextFieldDeleg ... -
NSTimer倒计时
2014-07-17 10:56 494// [NSTimer scheduledTimerWithT ... -
转】视图切换总结
2014-06-04 12:06 5071、利用ModalViewController切换View ... -
ios 判断网络连接以及获取路由信息
2014-05-29 11:53 1627首先 引入 Reachability.h 和Reachabil ... -
UINavigationController如何连续返回两级/回到第一级
2014-01-18 09:44 758//连续返回两级 int index=[[self.navig ...
相关推荐
NULL 博文链接:https://o0o0o0o.iteye.com/blog/588887
Swift-NSDate-Extensions 是 Swift NSDate 扩展,帮助开发。 标签:Swift
NSDate时间
NSDate总结,NSDateFormatter总结,NSCalender总结,倒计时(60秒倒计时,天数倒计时,cell上天数倒计时)
DateHelper - NSDate在Swift中的便利扩展
object-c基础语法NSDate, 适合初学者,主要学习NSDate的设置、获取当前时间、当前时间加减秒后的时间、日期比较、日期转换成NSString等
NSDate分类,获得对应中国农历
说明请看:http://blog.csdn.net/dolacmeng/article/details/51344748
一系列关于Date的小方法,包括NSDate和NSString的互相转换,大家自己看看每个方法的说明吧!
单例封装NSDateFormatter,根据需求自由封装显示时间格式
NSDate,iphone显示时间,日期的方法集合
iOS时间戳字符串NSDate转化demo
前言 记得之前看过一部有关机器人动画片,具体名字叫什么忘记了。...前一天或后一天时间 NSDate *lastDay = [NSDate dateWithTimeInterval:-24*60*60 sinceDate:date];//前一天 NSDate *nextDay = [NS
iOS ,扩展NSFDate , 可以帮助开发相关
(例如12:00包含10:00 ~ 20:00 ) 检查一个 TimeRange 是否与另一个 TimeRange 重叠。安装TimeRange 可通过。 要安装它,只需将以下行添加到您的 Podfile 中: pod "TimeRange"用法您可以尝试: pod try "TimeRange...
NSDate-DaboExtensionNSDate分类支持Pod导入pod 'NSDate-DaboExtension', '~> 1.0.0'
作者hullo-ai,源码Swift-2.3-AFDateHelper,AFDateHelper 是使用 Swift 编写的 NSDate 扩展。
NSDate-RFC1123 在Swift中实现HTTP日期 ,以解析类似Last-Modified的HTTP标头
使用算术运算符添加/删除日期组件: +, -, +=, -= 咖喱函数使用下标访问单个或一组日期组件要求iOS7 或以上斯威夫特 1.2用法直接从组件创建日期在 SWIFT 中采用默认参数值可以在创建日期时省略小时、分钟和秒参数,...
//返回一周的第几天(周末为第一天) - (NSUInteger)weekday; //转为NSString类型的 + (NSDate *)dateFromString:(NSString *)string; + (NSDate *)dateFromString:(NSString *)string withFormat:(NSString *)format;...