随笔分类 -  iOS功能封装

1 2 下一页

iOS工具 - NSLog日志打印出中文
摘要:NSLog 日志打印出中文 1 - NSLog日志可以正常打印出中文,而不被编译成其他字符,要实现这一功能对字典进行扩展即可 // - NSDictionary+Log.m 1 #import "NSDictionary+Log.h" 2 @implementation NSDictionary ( 阅读全文

posted @ 2021-11-21 04:05 低头捡石頭 阅读(395) 评论(0) 推荐(0) 编辑

iOS功能 - 使用UIRecognizer将图片添加手势(轻拍、捏合、拖动等)并存入系统相册
摘要:准备工作 1 - 和 iOS 10 保存图片、调用相机一样, 要 Info.plist 里面要涉及隐私数据时要添加一句提示语。打开 Info.plist 点击 + 号,在 Key 中输入:Privacy - Photo Library Additions Usage Description,Type 阅读全文

posted @ 2021-11-19 23:44 低头捡石頭 阅读(324) 评论(0) 推荐(0) 编辑

iOS功能 - 根据链接生成二维码图片(高清)
摘要:根据链接生成高清二维码 1 - 代码示例 1 -(void)generatingTwoDimensionalCode { 2 3 // 过滤器 4 CIFilter *filter = [CIFilter filterWithName:@"CIQRCodeGenerator"]; 5 6 // 默认 阅读全文

posted @ 2019-08-22 19:06 低头捡石頭 阅读(1498) 评论(0) 推荐(0) 编辑

iOS功能 - 从APP中跳转到手机设置
摘要:从 APP 跳转到手机设置界面 1 - 在 iOS 开发中,有时会有跳转系统设置界面的需求。在 iOS 6 之后第三方应用需要跳转系统设置界面,需要在 URL type 中添加一个 Prefs 值 2 - 用一个宏用来版本判定:#define iOS10 ([[UIDevice currentDev 阅读全文

posted @ 2017-07-25 15:28 低头捡石頭 阅读(25) 评论(0) 推荐(0) 编辑

UI定制 - UISearchBar:文本框圆角
摘要:文本框圆角 1 - 思路:对 UIView 进行扩展,在添加的方法中遍历出 UISearchBar 的 UISearchBarSearchFieldBackgroundView,在使用时对其修改即可 // - UIView+Utils.h #import <UIKit/UIKit.h> @inter 阅读全文

posted @ 2017-05-24 17:22 低头捡石頭 阅读(93) 评论(0) 推荐(0) 编辑

iOS功能 - 拨打电话
摘要:拨打电话 1 - 代码示例:弹出提示框,点击 呼叫 跳转到拨打电话界面,通话结束后返回 APP 页 1 -(void)callSomething{ 2 3 dispatch_after(0.2, dispatch_get_main_queue(), ^{ 4 5 UIWebView *callWeb 阅读全文

posted @ 2017-05-08 17:49 低头捡石頭 阅读(30) 评论(0) 推荐(0) 编辑

iOS功能 - 将图片或视图存入相册
摘要:将图片或视图存入相册 1 - 准备工作:配置 Info.plist 文件 <key>NSPhotoLibraryUsageDescription</key> <string>需要您的同意,才能访问您的媒体资料库</string> <key>NSPhotoLibraryAddUsageDescript 阅读全文

posted @ 2017-05-08 17:43 低头捡石頭 阅读(24) 评论(0) 推荐(0) 编辑

UI定制 - UISearchBar:居左显示
摘要:UISearchBar 居左显示 1 - 代码示例:新建 UISearchBar 子类 UINoMidSearchBar // - UINoMidSearchBar.h #import <UIKit/UIKit.h> @interface UINoMidSearchBar : UISearchBar 阅读全文

posted @ 2017-05-08 17:18 低头捡石頭 阅读(33) 评论(0) 推荐(0) 编辑

iOS功能 - 扫描二维码、条形码
摘要:扫描二维码 | 条形码 1 - 准备工作 ① 配置 Info.plist 文件(相机权限) <key>NSCameraUsageDescription</key> <string>App需您的同意才能访问相机</string> ② 使用到的扩展:充当遮罩层 // - UIImage+mask.h 1 阅读全文

posted @ 2017-05-08 15:43 低头捡石頭 阅读(34) 评论(0) 推荐(0) 编辑

UI定制 - 高仿百度外卖顶部波浪效果
摘要:高仿百度外卖顶部波浪效果 1 - 代码示例 // - WavesView.h 1 #import <UIKit/UIKit.h> 2 typedef void(^WavesBlock)(CGRect myFrame); 3 4 @interface WavesView : UIImageView 5 阅读全文

posted @ 2017-05-05 18:53 低头捡石頭 阅读(17) 评论(0) 推荐(0) 编辑

UI定制 - UITextField:动态检测文本
摘要:动态检测文本长度 1 - 代码示例:当 UITextField 内容长度大于 5 则改变本框背景色 1 #import "ViewController.h" 2 @interface ViewController () <UITextFieldDelegate>// 接受代理 3 4 @end 5 阅读全文

posted @ 2017-05-05 17:57 低头捡石頭 阅读(7) 评论(0) 推荐(0) 编辑

UI定制 - 根据键盘弹出高度动态调整视图位置(通知)
摘要:根据键盘弹出高度动态调整视图位置 1 - 思路:利用通知监听键盘状况,实时地调整视图位置 1 #import "ViewController.h" 2 @implementation ViewController 3 4 -(void)dealloc{ 5 // 移除通知 6 [[NSNotific 阅读全文

posted @ 2017-05-05 16:24 低头捡石頭 阅读(8) 评论(0) 推荐(0) 编辑

UI定制 - 水波纹效果(中心向外扩散)
摘要:水波纹(中心向外扩散) 1 - 代码封装 // - RippleView.h 1 #import <UIKit/UIKit.h> 2 @interface RippleView : UIView 3 4 @property (nonatomic, assign) NSTimeInterval tim 阅读全文

posted @ 2017-05-05 11:31 低头捡石頭 阅读(108) 评论(0) 推荐(0) 编辑

iOS工具 -对字典的键值对儿进行排序
摘要:键值对儿排序 1 - 代码封装:我们对 NSMutableDictionary 进行扩展 // - NSMutableDictionary+stringSortedFromDictionary.h 1 #import <Foundation/Foundation.h> 2 @interface NS 阅读全文

posted @ 2017-05-04 18:43 低头捡石頭 阅读(42) 评论(0) 推荐(0) 编辑

iOS工具 - MD5加密
摘要:MD5 加密 1 - 代码封装:对 NSString 进行扩展 // - NSString+MD5.h 1 #import <Foundation/Foundation.h> 2 @interface NSString (MD5) 3 4 + (NSString *)stringToMD5:(NSS 阅读全文

posted @ 2017-05-04 17:10 低头捡石頭 阅读(16) 评论(0) 推荐(0) 编辑

UI定制 - 改变导航栏样式
摘要:改变导航栏样式 1 - 我们对 UIViewController 进行扩展,实现导航栏自定制:以改变左标题、字体颜色、背景为例 2 - 代码示例 // - UIViewController+ChangeNavBar.h 1 #import <UIKit/UIKit.h> 2 @interface U 阅读全文

posted @ 2017-05-04 16:47 低头捡石頭 阅读(40) 评论(0) 推荐(0) 编辑

iOS工具 - 判断字符串是否为手机号码
摘要:判断字符串是否为手机号码 1 - 在实际开发中,往往需要判定手机号码 2 - 代码封装:我们对 NSString 进行扩展 // - NSString+isPhoneNumber.h 1 #import <Foundation/Foundation.h> 2 @interface NSString 阅读全文

posted @ 2017-05-04 16:27 低头捡石頭 阅读(19) 评论(0) 推荐(0) 编辑

iOS工具 - 单项修改Frame成员变量
摘要:单项修改成员变量 1 - OC 中是不允许单独修改结构体中成员变量的值,那么我们完全可对 UIView 进行扩展,实现对其尺寸、坐标的单项修改 2 - 代码封装 // - UIView+FrameAddions.h 1 #import <Foundation/Foundation.h> 2 #imp 阅读全文

posted @ 2017-05-04 15:51 低头捡石頭 阅读(30) 评论(0) 推荐(0) 编辑

iOS工具 - Base64
摘要:Base64 1 - Base64 是网络上最常见的用于传输 8 Bit 字节码的编码方式之一,Base64 就是一种基于 64 个可打印字符来表示二进制数据的方法 2 - 代码封装 // - Base64.h 1 #define __BASE64( text ) [CommonFunc base6 阅读全文

posted @ 2017-05-04 15:37 低头捡石頭 阅读(21) 评论(0) 推荐(0) 编辑

UI定制 - 跑马灯(文本)
摘要:跑马灯 1 - 代码封装 // - JTSlideShadowAnimation.h 1 #import <UIKit/UIKit.h> 2 @interface JTSlideShadowAnimation : NSObject <CAAnimationDelegate> 3 4 @propert 阅读全文

posted @ 2017-05-04 15:19 低头捡石頭 阅读(47) 评论(0) 推荐(0) 编辑

1 2 下一页
< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8

导航

统计

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