
iOS-知识点
Youyi.C
这个作者很懒,什么都没留下…
展开
-
stringByAppendingPathComponent和stringByAppendingString的区别
stringByAppendingString是字符串拼接,拼接路径时要在名称前加“/”;stringByAppendingPathComponent是路径拼接,会在字符串前自动添加“/”,成为完整路径。例如:NSString *imagePath = [skinPath stringByAppendingString:[NSString stringWithFormat:@"/%@...原创 2019-09-24 20:41:06 · 860 阅读 · 0 评论 -
改变headerView/footerView的背景颜色
- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(nonnull UIView *)view forSection:(NSInteger)section { view.tintColor = [UIColor clearColor];}原创 2019-09-24 20:38:44 · 379 阅读 · 0 评论 -
一句代码清空所有子视图
[view.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];原创 2019-09-24 20:28:08 · 203 阅读 · 0 评论 -
用storyboard、代码解决状态栏留白问题(即使tableView的y从0开始仍然无法从屏幕顶端开始)
想要达到视图从屏幕上边缘就开始显示怎么做?解决方案:1、代码if (@available(iOS 11.0, *)) { self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;} else { self.automaticallyAdjust...原创 2019-09-24 20:26:23 · 817 阅读 · 0 评论 -
iOS静态cell(static cell)和动态cell(dynamic cell)混合使用注意事项
使用方法网上很多不赘诉,只说注意事项,不做会崩溃1、 storyboard中动态Cell所在的section中必须预留一个Cell,可以是任意一个Cell;2、 - (NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath;方法必须重写;...原创 2019-09-24 17:40:34 · 644 阅读 · 0 评论 -
解决其它手势导致屏幕边缘侧滑返回上一页失效的方法
* 屏幕边缘侧滑返回上一页是因为响应了self.navigationController的interactivePopGestureRecognizer手势;* 返回失效的原因主要是UIPanGestureRecognizer与interactivePopGestureRecognizer两个手势发生冲突;* 利用 [手势A requireGestureRecognizerToFail:手...原创 2019-09-24 17:26:13 · 1427 阅读 · 0 评论 -
如何在storyboard设置圆角(cornerRadius)、边框(borderWidth)等操作。
目录方法1:Runtime Attributes方法2:使用@IBInspectable(下面以UIButton为例介绍使用方法)Step1:创建一个UIButton分类(Category)UIButton+LayerStep2:UIButton+Layer.h 中添加属性Step3:UIButton+Layer.m中实现setter、getter方法Step4:到这里前期...原创 2019-09-23 21:03:19 · 1295 阅读 · 0 评论 -
UIButton点击事件传值,除了用tag,还能这么传。
step1: 导入头文件,#import <objc/runtime.h>static NSString *keyOfTarget;step2: 创建button 添加方法runtime方法UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];[btn addTarget:self action...原创 2019-09-24 20:34:28 · 421 阅读 · 0 评论