摘要:
第一步,下载SDWebImage,导入工程。github托管地址https://github.com/rs/SDWebImage 第二步,在需要的地方导入头文件 1 #import "UIImageView+WebCache.h" 1 #import "UIImageView+WebCache.h"
阅读全文
posted @ 2017-02-20 11:14
Da雪山
阅读(2191)
推荐(0)
摘要:
博主文章链接:http://www.jianshu.com/p/935142af6a47 //1.不能添加的原因 首先, 使用@property的时候,系统会自动生成带“_”的成员变量和该变量的setter和getter方法。也就是说,属性相当于一个成员变量加getter和setter方法。 但是,
阅读全文
posted @ 2017-02-20 10:07
Da雪山
阅读(529)
推荐(0)
摘要:
//将某个 view 转换成图片 #pragma mark - shot - (UIImage *)imageFromView:(UIView *)theView { UIGraphicsBeginImageContext(theView.frame.size); CGContextRef cont
阅读全文
posted @ 2017-02-15 10:29
Da雪山
阅读(254)
推荐(0)
摘要:
iOS之事件的传递和响应机制-原理篇: http://www.jianshu.com/p/2e074db792ba //重写父视图的hitTest: withEvent:方法 ,从而使子视图完成相应的响应 #import <UIKit/UIKit.h> @interface XSView : UIV
阅读全文
posted @ 2017-02-09 18:41
Da雪山
阅读(924)
推荐(0)
摘要:
方法一:类别 #import <UIKit/UIKit.h> #import <objc/runtime.h> @interface UIButton (EnlargeEdge) - (void)XSsetEnlargeEdge:(CGFloat) size; - (void)XSsetEnlarg
阅读全文
posted @ 2017-02-09 18:39
Da雪山
阅读(430)
推荐(0)
摘要:
获取未来某一日期是星期几 /** * 获取未来某个日期是星期几 * 注意:featureDate 传递过来的格式 必须 和 formatter.dateFormat 一致,否则endDate可能为nil * */ - (NSString *)featureWeekdayWithDate:(NSStr
阅读全文
posted @ 2017-02-09 10:29
Da雪山
阅读(286)
推荐(0)
摘要:
//.h #import <UIKit/UIKit.h> @interface YSWaterWaveView : UIView - (void)startWaveToPercent:(CGFloat)percent; - (void)setGrowthSpeed:(CGFloat)growthSp
阅读全文
posted @ 2017-02-07 17:44
Da雪山
阅读(661)
推荐(0)
摘要:
UINavigationController 中有visibleViewController和topViewController visibleViewController 当前显示的控制器 topViewController 是某个导航栈的栈顶视图 visibleViewController跟导航
阅读全文
posted @ 2017-02-06 22:27
Da雪山
阅读(588)
推荐(0)
摘要:
demo 来源: https://github.com/jdg/MBProgressHUD/ //只有小菊花 - (void)indeterminateExample { // Show the HUD on the root view (self.view is a scrollable tabl
阅读全文
posted @ 2017-02-06 16:39
Da雪山
阅读(21179)
推荐(0)
摘要:
来自: http://www.cnblogs.com/dingding3w/p/6222626.html 如果没有UINavigationController导航栏页面之间切换是不能实现Push操作的,那我们平时见得无导航栏Push到下一页是怎么实现的呢? 现在跟大家分享一下实现原理, 就是在第一次
阅读全文
posted @ 2017-02-04 16:40
Da雪山
阅读(421)
推荐(0)
摘要:
-(void)getThreeMonthDate:(NSDate *)mydate { NSLog(@"%@",mydate); //1.创建NSCalendar NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifie
阅读全文
posted @ 2017-02-03 13:54
Da雪山
阅读(943)
推荐(0)
摘要:
// // ViewController.m // 图片点击放大 // // Created by xueshan on 17/1/19. // Copyright © 2017年 xueshan. All rights reserved. // #import "ViewController.h"
阅读全文
posted @ 2017-01-20 09:37
Da雪山
阅读(206)
推荐(0)
摘要:
#import <Foundation/Foundation.h> //3DES加密 @interface JKEncrypt : NSObject -(NSString *)doEncrypt:(NSString *)plainText; -(NSString*)doDecEncrypt:(NSS
阅读全文
posted @ 2017-01-18 15:09
Da雪山
阅读(1552)
推荐(0)
摘要:
/** * MD5 32位加密 * * @param string 原始字符串 * * @return 加密字符串 */ + (NSString *)getMd5_32Bit:(NSString *)string{ const char *cStr = [string UTF8String]; un
阅读全文
posted @ 2017-01-18 13:38
Da雪山
阅读(722)
推荐(0)
摘要:
//随机生成一个128位的字符串 + (NSString *)randomStringWith128 { int num = arc4random() % 128 + 1; char *s = genRandomChar(num); NSString *rString = [NSString str
阅读全文
posted @ 2017-01-18 13:27
Da雪山
阅读(782)
推荐(0)
摘要:
参考: http://www.open-open.com/lib/view/open1430008922468.html - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the v
阅读全文
posted @ 2017-01-13 10:59
Da雪山
阅读(1644)
推荐(0)
摘要:
//iOS5以前设置拉伸图片 -(void)loadImageBeforeIOS5{ //35*30 UIButton *nextButton = [[UIButton alloc] initWithFrame:CGRectMake(80, 180, 100, 40)]; [nextButton s
阅读全文
posted @ 2017-01-10 14:12
Da雪山
阅读(327)
推荐(0)
摘要:
首先举一个例子: 匹配9-15个由字母/数字组成的字符串的正则表达式: NSString * regex = @"^[A-Za-z0-9]{9,15}$"; NSPredicate *pred = [NSPredicate predicateWithFormat:@"SELF MATCHES %@"
阅读全文
posted @ 2017-01-04 13:53
Da雪山
阅读(12566)
推荐(0)
摘要:
CAEmitterLayer 实现雪花效果 首先需要导入#import <QuartzCore/QuartzCore.h> /**在iOS 5中,苹果引入了一个新的CALayer子类叫做CAEmitterLayer。CAEmitterLayer是一个高性能的粒子引擎,被用来创建实时例子动画如:烟雾,
阅读全文
posted @ 2017-01-04 10:17
Da雪山
阅读(261)
推荐(0)
摘要:
//CADisplayLink 和屏幕刷新频率相同 //开始下雪 - (void) beginShow{ //启动定时器,使得一直调用setNeedsDisplay从而调用- (void) drawRect:(CGRect )rect //不得手动调用- (void) drawRect:(CGRec
阅读全文
posted @ 2017-01-03 20:24
Da雪山
阅读(251)
推荐(0)
摘要:
@interface ViewController () @property (nonatomic,strong)UIImageView *topImageView; @property(nonatomic,strong)UIImageView *bottomImageView; @end @imp
阅读全文
posted @ 2017-01-03 08:35
Da雪山
阅读(211)
推荐(0)
摘要:
//1.如何使服务器兼容Emoji表情符号的几种办法 http://www.jianshu.com/p/aa559c913323 //2.是否包含表情 - (BOOL)isContainsEmoji:(NSString *)string { __block BOOL isEomji = NO; [s
阅读全文
posted @ 2016-12-29 16:22
Da雪山
阅读(499)
推荐(0)
摘要:
1. //有字符串“A~B^C_D>E",拆分出单个字母: NSString *str =@" A~B^C_D>E "; str = [str stringByTrimmingCharactersInSet:[NSCharacterSetwhitespaceAndNewlineCharacterSe
阅读全文
posted @ 2016-12-29 10:13
Da雪山
阅读(280)
推荐(0)
摘要:
from: http://www.tuicool.com/articles/vuyIriN 当我们使用系统自带的UICollectionViewFlowLayout无法实现我们的布局时,我们就可以考虑自定义layout。 所以,了解并学习一下自定义Layout是很有必要。 其实可以分三个步骤: fr
阅读全文
posted @ 2016-12-26 13:34
Da雪山
阅读(4528)
推荐(0)
摘要:
本地化封装了关于语言,文化以及技术约定和规范的信息。用于提供于用户所处地域相关的定制化信息和首选项信息的设置。通过获取用户的本地化信息设置,我们可以为用户提供更加友好人性化的界面设置,包括更改更改应用程序的界面的语言,货币类型,数字,日期格式的格式化,提供正确的地理位置显示等等。IOS内置为应用程序
阅读全文
posted @ 2016-12-22 11:40
Da雪山
阅读(603)
推荐(0)
摘要:
// // ViewController.m // animation // // Created by xueshan on 16/12/15. // Copyright © 2016年 xueshan. All rights reserved. // #import "ViewControlle
阅读全文
posted @ 2016-12-15 20:23
Da雪山
阅读(2199)
推荐(0)
摘要:
#import <AudioToolbox/AudioToolbox.h> - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a n
阅读全文
posted @ 2016-12-15 16:42
Da雪山
阅读(228)
推荐(0)
摘要:
//注册键盘出现的通知 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWasShown:) name:UIKeyboardWillShowNotification object:ni
阅读全文
posted @ 2016-12-14 18:19
Da雪山
阅读(188)
推荐(0)
摘要:
#define SNOWPOSITION (arc4random() % (int)self.view.frame.size.width) #define SNOWWIDTH (arc4random() % 20 + 10) @interface XLRightViewController () {
阅读全文
posted @ 2016-12-06 15:58
Da雪山
阅读(169)
推荐(0)
摘要:
iOS常用公共方法 1. 获取磁盘总空间大小 //磁盘总空间 + (CGFloat)diskOfAllSizeMBytes{ CGFloat size = 0.0; NSError *error; NSDictionary *dic = [[NSFileManager defaultManager]
阅读全文
posted @ 2016-12-02 18:22
Da雪山
阅读(376)
推荐(0)
摘要:
自定义 View .h #import <UIKit/UIKit.h> @interface PooCodeView : UIView @property (nonatomic, retain) NSArray *changeArray; @property (nonatomic, retain)
阅读全文
posted @ 2016-11-23 14:29
Da雪山
阅读(837)
推荐(0)
摘要:
简介 苹果从iPhone5S开始,具有指纹识别技术,从iOS8.0之后苹果允许第三方 App 使用 Touch ID进行身份验证。指纹识别Touch ID提供3+2共5次指纹识别机会(3次识别失败后,弹出的指纹验证框会消失,同时会报错code = -1,然后点击指纹会再次弹框可验证两次),如果五次指
阅读全文
posted @ 2016-11-23 09:11
Da雪山
阅读(843)
推荐(0)
posted @ 2016-11-18 13:32
Da雪山
阅读(258)
推荐(0)
摘要:
iOS视频压缩AVAssetExportSession 字数55 阅读3 评论0 喜欢1 AVAssetExportSession是系统自带的压缩首先导入头文件 #import <AVFoundation/AVFoundation.h> #import <MobileCoreServices/Mob
阅读全文
posted @ 2016-11-15 17:58
Da雪山
阅读(518)
推荐(0)
摘要:
#pragma mark -- 去 app store - (void)jumpToAppStore{ NSString *evaluateString = [NSString stringWithFormat:@"http://itunes.apple.com/WebObjects/MZStore
阅读全文
posted @ 2016-11-14 10:22
Da雪山
阅读(155)
推荐(0)
摘要:
苹果是非常看重产品的安全性的,所以给用户设计了一套复杂的安全机制。这让喜爱自由,崇尚一切开放的程序员们极度不爽,于是越狱就成了苹果和黑客们反复斗法的场所。总体来说,越狱可以让我们随意安装、共享应用,但确实也降低了设备的安全性,会给一些恶意应用提供方便之门。 有时我们的应用希望知道安装的设备是否已经越
阅读全文
posted @ 2016-11-11 15:47
Da雪山
阅读(191)
推荐(0)
摘要:
//id #import <AdSupport/AdSupport.h> //ip #include <ifaddrs.h> #include <arpa/inet.h> #pragma mark -- 获取用户 id //通过AdSupport获取UUID(原因AdSupport可以跨应用) -
阅读全文
posted @ 2016-11-09 14:16
Da雪山
阅读(400)
推荐(0)
摘要:
0.AVCapture <AVFoundation/AVFoundation.h> 媒体采集需要的几个对象: 1、AVCaptureDevice: 代表抽象的硬件设备(如前置摄像头,后置摄像头等)。 2、AVCaptureInput: 代表输入设备(可以是它的子类),它配置抽象硬件设备的ports。
阅读全文
posted @ 2016-11-04 16:19
Da雪山
阅读(892)
推荐(0)
摘要:
UISearchController实现搜索 通过 UISearchController 实现 UISearchResultsUpdating 这个委托实现上面的效果; 视图中中需要声明UISearchResultsUpdating: 属性声明: 需要自己初始化一下UISearchControlle
阅读全文
posted @ 2016-11-04 09:44
Da雪山
阅读(210)
推荐(0)
摘要:
IOS NSPredicate 查询、搜索 简述:Cocoa框架中的NSPredicate用于查询,原理和用法都类似于SQL中的where,作用相当于数据库的过滤取。 最常用到的函数 + (NSPredicate *)predicateWithFormat:(NSString *)predicate
阅读全文
posted @ 2016-11-04 09:14
Da雪山
阅读(715)
推荐(0)