@全体成员 关于iOS11 和 iPhone X适配的问题 自行参考以下文章
#define WS(ws) __weak typeof(self) ws = self
#define SS(ss) __strong typeof(self)ss = self
//判断某点是不是在某个View上
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
{
if (CGRectContainsPoint(self.bounds, point))
{
return YES;
}
else
{
[self dismiss];
return NO;
// 设置导航栏按钮状态颜色
UIBarButtonItem *rightItem = [[UIBarButtonItem alloc]initWithTitle:@"清空" style:UIBarButtonItemStylePlain target:self action:@selector(clearAction:)];
[rightItem setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#ffffff"]} forState:UIControlStateNormal];
[rightItem setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#ffbe8f"]} forState:UIControlStateHighlighted];
self.navigationItem.rightBarButtonItem = rightItem;
记录一下 一个app icon 自动生成的网站
http://icon.wuruihong.com
在手机中各个角度的位置//计算 距离现在的时间
-(NSString *)getUTCFormateDate:(NSDate *)newsDate
{ NSString *dateContent;
NSTimeInterval secondsPerDay = 24 * 60 * 60;
NSDate *today=[[NSDate alloc] init];
NSDate *yearsterDay = [[NSDate alloc] initWithTimeIntervalSinceNow:-secondsPerDay];
NSDate *qianToday = [[NSDate alloc] initWithTimeIntervalSinceNow:-2*secondsPerDay];
//假设这是你要比较的date:NSDate *yourDate = ……
//日历
NSCalendar* calendar = [NSCalendar currentCalendar];
unsigned unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit;
NSDateComponents* comp1 = [calendar components:unitFlags fromDate:newsDate];
NSDateComponents* comp2 = [calendar components:unitFlags fromDate:yearsterDay];
NSDateComponents* comp3 = [calendar components:unitFlags fromDate:qianToday];
NSDateComponents* comp4 = [calendar components:unitFlags fromDate:today]; if ( comp1.year == comp2.year && comp1.month == comp2.month && comp1.day == comp2.day) {
dateContent = @"昨天";
} else if (comp1.year == comp3.year && comp1.month == comp3.month && comp1.day == comp3.day) {
dateContent = @"前天";
} else if (comp1.year == comp4.year && comp1.month == comp4.month && comp1.day == comp4.day) {
dateContent = @"今天";
} else {
//返回0说明该日期不是今天、昨天、前天
dateContent = @"0";
}
return dateContent;
}
分享到微信再次分享出现图片不显示的问题
os上分享出来时是调用了微信的app分享sdk,已经通过验证和相关配置,所以第一次正常显示图片和标题等,这里的分享源头是APP。
然而分享到微信后,二次分享时,分享源头变成了微信客户端,这时微信是需要验证页面的jssdk分享配置的,验证成功才会为你添加图片和标题等。
所以解决办法是,在分享的页面里添加对微信jssdk分享接口的调用,添加相关配置参数,并且在微信公众号后台里配置好页面的所在的域名为安全域名才行。
设置距离今天18年前的date
NSDate *currentDate = currentDate = [NSDate date];
NSCalendar *calendar = nil; if ([UIDevice currentDevice].systemVersion.doubleValue >= 8.0)
{
calendar = [NSCalendar calendarWithIdentifier:NSCalendarIdentifierGregorian];
} else {
calendar = [NSCalendar currentCalendar];
}
NSDateComponents *dateComponents = [calendar components:NSYearCalendarUnit fromDate:currentDate];
[date Components setYear:-18];
NSDate *newdate = [calendar dateByAddingComponents:dateComponents toDate:currentDate options:0];
周几
- (NSString *)calculateWeek:(NSDate *)date{
//计算week数
NSCalendar * myCalendar = [NSCalendar currentCalendar];
myCalendar.timeZone = [NSTimeZone systemTimeZone];
NSInteger week = [[myCalendar components:NSWeekdayCalendarUnit fromDate:date] weekday];
NSLog(@"week : %zd",week);
switch (week) {
case 1: { return @"周日"; }
case 2: { return @"周一"; }
case 3: { return @"周二"; }
case 4: { return @"周三"; }
case 5: { return @"周四"; }
case 6: { return @"周五"; }
case 7: { return @"周六"; }
}
return @"";}
按钮文字对齐方式
Button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;//左对齐(UIControlContentHorizontalAlignment、CenterUIControlContentHorizontalAlignmentFill、UIControlContentHorizontalAlignmentRight)
Button.contentVerticalAlignment = UIControlContentVerticalAlignmentBottom;//底部对其(UIControlContentVerticalAlignmentCenter、UIControlContentVerticalAlignmentFill、UIControlContentVerticalAlignmentTop)
一个答题翻页看小说左右滑动的第三方控制器 https://github.com/dengzemiao/DZMCoverAnimation
https://www.cnblogs.com/lijuntao/p/6489610.html 让别人访问自己的电脑 不知道可行不可行
https://github.com/kostub/iosMath
第三方 旋转木马 pod 'iCarousel', '~> 1.8.3'https://www.jianshu.com/p/3ba3990d1549
网友评论