摘要:NSLog 日志打印出中文 1 - NSLog日志可以正常打印出中文,而不被编译成其他字符,要实现这一功能对字典进行扩展即可 // - NSDictionary+Log.m 1 #import "NSDictionary+Log.h" 2 @implementation NSDictionary (
阅读全文
摘要:准备工作 1 - 和 iOS 10 保存图片、调用相机一样, 要 Info.plist 里面要涉及隐私数据时要添加一句提示语。打开 Info.plist 点击 + 号,在 Key 中输入:Privacy - Photo Library Additions Usage Description,Type
阅读全文
摘要:根据链接生成高清二维码 1 - 代码示例 1 -(void)generatingTwoDimensionalCode { 2 3 // 过滤器 4 CIFilter *filter = [CIFilter filterWithName:@"CIQRCodeGenerator"]; 5 6 // 默认
阅读全文
摘要:从 APP 跳转到手机设置界面 1 - 在 iOS 开发中,有时会有跳转系统设置界面的需求。在 iOS 6 之后第三方应用需要跳转系统设置界面,需要在 URL type 中添加一个 Prefs 值 2 - 用一个宏用来版本判定:#define iOS10 ([[UIDevice currentDev
阅读全文
摘要:文本框圆角 1 - 思路:对 UIView 进行扩展,在添加的方法中遍历出 UISearchBar 的 UISearchBarSearchFieldBackgroundView,在使用时对其修改即可 // - UIView+Utils.h #import <UIKit/UIKit.h> @inter
阅读全文
摘要:拨打电话 1 - 代码示例:弹出提示框,点击 呼叫 跳转到拨打电话界面,通话结束后返回 APP 页 1 -(void)callSomething{ 2 3 dispatch_after(0.2, dispatch_get_main_queue(), ^{ 4 5 UIWebView *callWeb
阅读全文
摘要:将图片或视图存入相册 1 - 准备工作:配置 Info.plist 文件 <key>NSPhotoLibraryUsageDescription</key> <string>需要您的同意,才能访问您的媒体资料库</string> <key>NSPhotoLibraryAddUsageDescript
阅读全文
摘要:UISearchBar 居左显示 1 - 代码示例:新建 UISearchBar 子类 UINoMidSearchBar // - UINoMidSearchBar.h #import <UIKit/UIKit.h> @interface UINoMidSearchBar : UISearchBar
阅读全文
摘要:扫描二维码 | 条形码 1 - 准备工作 ① 配置 Info.plist 文件(相机权限) <key>NSCameraUsageDescription</key> <string>App需您的同意才能访问相机</string> ② 使用到的扩展:充当遮罩层 // - UIImage+mask.h 1
阅读全文
摘要:高仿百度外卖顶部波浪效果 1 - 代码示例 // - WavesView.h 1 #import <UIKit/UIKit.h> 2 typedef void(^WavesBlock)(CGRect myFrame); 3 4 @interface WavesView : UIImageView 5
阅读全文
摘要:动态检测文本长度 1 - 代码示例:当 UITextField 内容长度大于 5 则改变本框背景色 1 #import "ViewController.h" 2 @interface ViewController () <UITextFieldDelegate>// 接受代理 3 4 @end 5
阅读全文
摘要:根据键盘弹出高度动态调整视图位置 1 - 思路:利用通知监听键盘状况,实时地调整视图位置 1 #import "ViewController.h" 2 @implementation ViewController 3 4 -(void)dealloc{ 5 // 移除通知 6 [[NSNotific
阅读全文
摘要:水波纹(中心向外扩散) 1 - 代码封装 // - RippleView.h 1 #import <UIKit/UIKit.h> 2 @interface RippleView : UIView 3 4 @property (nonatomic, assign) NSTimeInterval tim
阅读全文
摘要:键值对儿排序 1 - 代码封装:我们对 NSMutableDictionary 进行扩展 // - NSMutableDictionary+stringSortedFromDictionary.h 1 #import <Foundation/Foundation.h> 2 @interface NS
阅读全文
摘要:MD5 加密 1 - 代码封装:对 NSString 进行扩展 // - NSString+MD5.h 1 #import <Foundation/Foundation.h> 2 @interface NSString (MD5) 3 4 + (NSString *)stringToMD5:(NSS
阅读全文
摘要:改变导航栏样式 1 - 我们对 UIViewController 进行扩展,实现导航栏自定制:以改变左标题、字体颜色、背景为例 2 - 代码示例 // - UIViewController+ChangeNavBar.h 1 #import <UIKit/UIKit.h> 2 @interface U
阅读全文
摘要:判断字符串是否为手机号码 1 - 在实际开发中,往往需要判定手机号码 2 - 代码封装:我们对 NSString 进行扩展 // - NSString+isPhoneNumber.h 1 #import <Foundation/Foundation.h> 2 @interface NSString
阅读全文
摘要:单项修改成员变量 1 - OC 中是不允许单独修改结构体中成员变量的值,那么我们完全可对 UIView 进行扩展,实现对其尺寸、坐标的单项修改 2 - 代码封装 // - UIView+FrameAddions.h 1 #import <Foundation/Foundation.h> 2 #imp
阅读全文
摘要:Base64 1 - Base64 是网络上最常见的用于传输 8 Bit 字节码的编码方式之一,Base64 就是一种基于 64 个可打印字符来表示二进制数据的方法 2 - 代码封装 // - Base64.h 1 #define __BASE64( text ) [CommonFunc base6
阅读全文
摘要:跑马灯 1 - 代码封装 // - JTSlideShadowAnimation.h 1 #import <UIKit/UIKit.h> 2 @interface JTSlideShadowAnimation : NSObject <CAAnimationDelegate> 3 4 @propert
阅读全文