BOOL result = NO;
CGPoint touchPoint = [touch locationInView:self.centerbgView];
if (!CGRectContainsPoint(self.centerbgView.bounds, touchPoint)) result = YES;
return result;
}
+ (UIImage*)imageWithColor:(UIColor*)color
{
CGRect rect = CGRectMake(0.0f, 0.0f, 8.0f, 8.0f);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [color CGColor]);
CGContextFillRect(context, rect);
UIImage*theImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return theImage;
}
forBarMetrics有点类似于按钮的for state状态,即什么状态下显示
//UIBarMetricsDefault-竖屏横屏都有,横屏导航条变宽,则自动repeat图片
//UIBarMetricsCompact-竖屏没有,横屏有,相当于之前老iOS版本里地UIBarMetricsLandscapePhone
理论上,设置prompt属性后另外两种设置起效。但是实际测试发现即使设置了prompt属性,prompt的参数也无效,前两个选项完全有效。也就是说,最新的版本中只有前两个有效
self.navigationItem.prompt = @"Navigation prompts appear at the top.";
//UIBarMetricsDefaultPrompt = 101, 竖屏, 并且带prompt文字的情况下显示图片
The whole point of weak
is that the property becomes nil
when the object is deallocated. The whole point of nonnull
is that the property can never be nil
. That's why you can't apply both.
Either make your property strong nonnull
or just weak
10, 将16进制字符串转换成无符号长整型字符串
valueString = [NSString stringWithFormat:@"%ld",strtoul([valueString UTF8String],0,16)];
重要方法:strtoul() 第三个参数表示要转换字符串的机制,base 必须介于 2 和 36(包含)之间,或者是特殊值 0
11,解决iOS11tableView:heightForHeaderInSection:方法不执行的问题
需要设置sectionHeaderHeight
https://www.jianshu.com/p/abcab8b75220