随笔分类 -  iOS

摘要:1. 创建webView时使用:作用是允许h5多页面,手势滑动 wkWebView.allowsBackForwardNavigationGestures = true 2. 因为App系统自带侧滑手势返回,所以要这样做: //监听侧滑手势 let swiperGesture = UISwipeGe 阅读全文
posted @ 2021-07-23 14:22 liuw_flexi 阅读(1023) 评论(0) 推荐(0) 编辑
摘要:参考: https://www.jianshu.com/p/a97fcc09f2e4 https://blog.csdn.net/qq_15289761/article/details/107205278 1. OC:这里我是在本身获取的字符串基础上拼接一个字符串,尽量不覆盖 [webView ev 阅读全文
posted @ 2021-07-08 15:20 liuw_flexi 阅读(1577) 评论(0) 推荐(0) 编辑
摘要:红板报App首页翻折效果: 思路参考: http://blog.sina.com.cn/s/blog_7011f21c0101a95a.html 现有代码参考:https://github.com/adow/WKFlipsView Flipboard 页面设计历史:https://www.sj33. 阅读全文
posted @ 2020-12-17 15:22 liuw_flexi 阅读(157) 评论(0) 推荐(0) 编辑
摘要:pic: 阅读全文
posted @ 2020-12-11 11:24 liuw_flexi 阅读(57) 评论(0) 推荐(0) 编辑
摘要:不管是UIView,还是UIViewController或者子类 在切换 ”设置“ 中的 “显示与亮度” 中 模式时,都会调用一个方法,这个方法是系统API swift: //MARK:暗黑模式监听 override func traitCollectionDidChange(_ previousT 阅读全文
posted @ 2020-11-05 09:59 liuw_flexi 阅读(791) 评论(0) 推荐(0) 编辑
摘要:转自: https://www.jianshu.com/p/41d1359b2c80 没有继承就没有多态 代码的体现:父类类型的指针指向子类对象 好处:如果函数方法参数中使用的是父类类型,则可以传入父类和子类对象,而不用再去定义多个函数来和相应的类进行匹配了。 局限性:父类类型的变量不能直接调用子类 阅读全文
posted @ 2020-10-13 15:17 liuw_flexi 阅读(90) 评论(0) 推荐(0) 编辑
摘要:我开发的一个App中涉及了mp3播放, 但正播放酷我音乐,打开我开发的一个App,酷我音乐立即停止了, 我不希望这样,我希望在我开始播放我开发的一个App中mp3时再停止酷我音乐 解决办法: 不要在AppDelegate中写这段代码,因为一打开App就会走这里,可以试着放到播放按钮那里 AVAudi 阅读全文
posted @ 2020-10-09 16:04 liuw_flexi 阅读(1081) 评论(0) 推荐(0) 编辑
摘要:要实现后台播放的功能,在 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 方法添加如下代码 //在静音模式下也能播放音频 进入后台 阅读全文
posted @ 2020-05-07 17:01 liuw_flexi 阅读(452) 评论(0) 推荐(0) 编辑
摘要:参考自: https://www.jianshu.com/p/0dfccd073ae0 https://www.cnblogs.com/kingbo/p/7162364.html CALayer *MamiLayer = [CALayer layer]; MamiLayer.backgroundCo 阅读全文
posted @ 2020-04-27 15:57 liuw_flexi 阅读(894) 评论(0) 推荐(0) 编辑
摘要:用 UICollectionViewFlowLayout 来做 PagingEnableLayout.h #import <UIKit/UIKit.h> @interface PagingEnableLayout : UICollectionViewFlowLayout @end PagingEna 阅读全文
posted @ 2020-04-27 13:54 liuw_flexi 阅读(409) 评论(0) 推荐(0) 编辑
摘要:参考自 https://www.cnblogs.com/liuting-1204/p/5960815.html //scrollView滚动时,就调用该方法。任何offset值改变都调用该方法。即滚动过程中,调用多次 - (void)scrollViewDidScroll:(UIScrollView 阅读全文
posted @ 2020-04-20 16:23 liuw_flexi 阅读(266) 评论(0) 推荐(0) 编辑
摘要:// // SceneDelegate.swift // 菜鸟教程 // // Created by udc on 2019/11/29. // Copyright © 2019 udc. All rights reserved. // import UIKit class SceneDelegat 阅读全文
posted @ 2020-04-03 13:13 liuw_flexi 阅读(1316) 评论(0) 推荐(0) 编辑
摘要:需求: 现在有一个页面,有A, B, C 3个网络请求。A, B是非必须,C是必须,所有请求完毕之后要刷新tableView。 这里当然可以使用异步并发,每个请求的成功或者失败中刷新tableView。 如果要用信号量来控制呢?顺便复习一遍吧。 信号量(Semaphore)是多线程环境下的一种保护设 阅读全文
posted @ 2020-03-25 11:37 liuw_flexi 阅读(166) 评论(0) 推荐(0) 编辑
摘要:一 . 用AFHTTPSessionManager中的这个方法 - (NSURLSessionDataTask *)POST:(NSString *)URLString parameters:(id)parameters constructingBodyWithBlock:(void (^)(id 阅读全文
posted @ 2020-03-18 14:43 liuw_flexi 阅读(2947) 评论(0) 推荐(0) 编辑
摘要:参考 https://www.jianshu.com/p/d2b0f20e2e96 说的比较全 https://www.jianshu.com/p/35831f573109 解决白边问题 我用的是1242 *2208分辨率的图片,好像其他尺寸会有白边的问题。图片的显示模式用的是Aspect Fill 阅读全文
posted @ 2020-03-16 15:59 liuw_flexi 阅读(4157) 评论(0) 推荐(0) 编辑
摘要:clipsToBounds(UIView)是指视图上的子视图,如果超出父视图的部分就截取掉 masksToBounds(CALayer)却是指视图的图层上的子图层,如果超出父图层的部分就截取掉 阅读全文
posted @ 2020-03-10 16:58 liuw_flexi 阅读(988) 评论(0) 推荐(0) 编辑
摘要:https://github.com/ZipArchive/ZipArchive/issues/519 使用SSZipArchive 注意事项: 4. Add the following GCC_PREPROCESSOR_DEFINITIONS: HAVE_INTTYPES_H HAVE_PKCRY 阅读全文
posted @ 2020-03-06 11:33 liuw_flexi 阅读(1531) 评论(0) 推荐(0) 编辑
摘要:heic 格式的照片,传给后台,web端可能无法显示。所以考虑转成jpg 或者png格式。 注意:光改文件的后缀是不行的,还得转一下NSData格式。 CIImage *ciImage = [CIImage imageWithData:imageData]; CIContext *context = 阅读全文
posted @ 2020-03-03 11:24 liuw_flexi 阅读(1217) 评论(0) 推荐(0) 编辑
摘要:#pragma mark 判断手机号码格式是否正确 + (BOOL)valiMobile:(NSString *)mobileNum { /** * 手机号码 * 移动:134[0-8],135,136,137,138,139,150,151,157,158,159,182,187,188 * 14 阅读全文
posted @ 2020-02-19 10:08 liuw_flexi 阅读(1017) 评论(0) 推荐(0) 编辑
摘要:有时候从App上传图片给后台,由于图片较大, 需要将图片压缩一下。 压缩的时候注意有的方案会卡线程,耗时。 这里有个方案:不耗时,不卡线程 -(UIImage *)makeThumbnailFromImage:(UIImage *)srcImage scale:(double)imageScale{ 阅读全文
posted @ 2020-02-18 12:49 liuw_flexi 阅读(342) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示