摘要:
新添加判断iPhone 7、iPhone 7 Plus ,我手里没有7,判断不对表打我~ FQ找的资料:http://www.iphonehacks.com/download-iphone-ios-firmware 1.手机系统:iPhone OS NSString* phoneVersion =
阅读全文
posted @ 2016-11-03 15:54
Da雪山
阅读(2190)
推荐(0)
摘要:
#import "ViewController.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // // NSLog(@"缓
阅读全文
posted @ 2016-11-02 19:05
Da雪山
阅读(290)
推荐(0)
摘要:
//导入库 #import <CoreLocation/CoreLocation.h> //注意: //需要在 info.plist 中导入前两个字段 //NSLocationAlwaysUsageDescription //NSLocationWhenInUseUsageDescription @
阅读全文
posted @ 2016-11-02 16:47
Da雪山
阅读(6157)
推荐(0)
摘要:
/** * 获取用户ip * * @return 获取用户ip */ + (NSString *)getIPAddress { NSString *address = @"an error occurred when obtaining ip address"; struct ifaddrs *in
阅读全文
posted @ 2016-11-01 17:43
Da雪山
阅读(857)
推荐(0)
摘要:
CAShapeLayer是基于贝塞尔曲线而存在的, 如果没有贝塞尔曲线提供路径来画出图形, CAShapeLayer就没有存在的意义, CAShapeLayer可以使得不用在 drawRect:方法中实现画图. 另外, CAShapeLayer是属于CoreAnimation框架的, 是基于GPU的
阅读全文
posted @ 2016-10-26 17:32
Da雪山
阅读(437)
推荐(0)
摘要:
CATransition动画来实现, 下面的代码是跳转到下一个视图: CATransition *animation = [CATransition animation]; [animation setDuration:0.3]; [animation setType: kCATransitionP
阅读全文
posted @ 2016-10-26 11:03
Da雪山
阅读(269)
推荐(0)
摘要:
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{ 功能: 把textField中位置为range的
阅读全文
posted @ 2016-10-19 16:32
Da雪山
阅读(380)
推荐(0)
摘要:
正常程序退出后,会在几秒内停止工作;要想申请更长的时间,需要用到beginBackgroundTaskWithExpirationHandlerendBackgroundTask一定要成对出现
阅读全文
posted @ 2016-10-13 16:40
Da雪山
阅读(187)
推荐(0)
摘要:
一. 程序外调用系统发短信 [[UIApplication sharedApplication]openURL:[NSURL URLWithString:@sms://13888888888]]; 二.程序内调用系统发短信 #import <MessageUI/MessageUI.h> 2)实现代理
阅读全文
posted @ 2016-10-11 10:35
Da雪山
阅读(207)
推荐(0)
摘要:
下面的类已从AFNetworking 3.0中废弃: AFURLConnectionOperation AFHTTPRequestOperation AFHTTPRequestOperationManager 现在核心代码:AFHTTPSessionManager,<AFNrtworking3.1.
阅读全文
posted @ 2016-09-23 11:44
Da雪山
阅读(706)
推荐(0)
摘要:
UIBezierPath贝塞尔弧线常用方法 UIBezierPath贝塞尔弧线常用方法 //根据一个矩形画曲线 + (UIBezierPath *)bezierPathWithRect:(CGRect)rect //根据矩形框的内切圆画曲线 + (UIBezierPath *)bezierPathW
阅读全文
posted @ 2016-09-22 11:10
Da雪山
阅读(187)
推荐(0)
摘要:
- (void)createBaseAnimation{ //基础动画 CABasicAnimation *animation = [CABasicAnimation animation]; animation.keyPath = @"bounds"; // animation.fromValue
阅读全文
posted @ 2016-09-19 22:10
Da雪山
阅读(206)
推荐(0)
摘要:
#import <AVFoundation/AVFoundation.h> #import <AssetsLibrary/AssetsLibrary.h> @interface ViewController ()<AVCaptureFileOutputRecordingDelegate> @prop
阅读全文
posted @ 2016-09-08 11:13
Da雪山
阅读(989)
推荐(0)
摘要:
// iphone沙箱模型的有四个文件夹,分别是什么,永久数据存储一般放在什么位置,得到模拟器的路径的简单方式是什么. // documents,tmp,app,Library。 // (NSHomeDirectory())手动保存的文件在documents文件里 // Nsuserdefaults
阅读全文
posted @ 2016-09-08 11:07
Da雪山
阅读(272)
推荐(0)
摘要:
封装CoreManager类 @implementation CoreDataManager { //上下文 NSManagedObjectContext *_ctx; } //单例 +(instancetype)sharedManager { static CoreDataManager *man
阅读全文
posted @ 2016-09-07 16:53
Da雪山
阅读(172)
推荐(0)
摘要:
一.系统自带 [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. self.view.backgroundColor = [UIColor whiteColor];
阅读全文
posted @ 2016-09-07 14:24
Da雪山
阅读(268)
推荐(0)
摘要:
程序进入后台,延迟指定时间退出 正常程序退出后,会在几秒内停止工作;要想申请更长的时间,需要用到beginBackgroundTaskWithExpirationHandlerendBackgroundTask一定要成对出现 { NSTimer *_timer; int aa; __block UI
阅读全文
posted @ 2016-09-07 11:45
Da雪山
阅读(2088)
推荐(0)
摘要:
汇总: NSScanner: NSScanner是一个类,用于在字符串中扫描指定的字符,尤其是把它们翻译/转换为数字和别的字符串。可以在创建NSScaner时指定它的string属性,然后scanner会按照你的要求从头到尾地扫描这个字符串的每个字符。 NSCharacterSet:主要用来判断已知
阅读全文
posted @ 2016-09-06 08:42
Da雪山
阅读(2990)
推荐(0)
摘要:
导入库#import <AddressBook/AddressBook.h> #import <AddressBookUI/AddressBookUI.h> #pragma mark 点击 弹出通讯录 - (IBAction)contactClicked:(id)sender { //1. 创建联系
阅读全文
posted @ 2016-09-05 22:57
Da雪山
阅读(347)
推荐(0)
摘要:
导入库文件 #import <ContactsUI/ContactsUI.h> #pragma mark iOS9 新出的点击通讯录的获取信息的办法 #pragma mark - 先弹出联系人控制器 - (IBAction)ios9Clicked:(id)sender { // 1. 创建控制器 C
阅读全文
posted @ 2016-09-05 22:54
Da雪山
阅读(368)
推荐(0)
摘要:
#pragma mark 获取通讯录 - (NSMutableArray *)accessAddressBookAddress{ NSMutableArray * addressBookTemp=[[NSMutableArray alloc]initWithCapacity:0]; //新建一个通讯
阅读全文
posted @ 2016-09-05 22:50
Da雪山
阅读(156)
推荐(0)
摘要:
//传入数据,饼状图 pieChartView.dataArr = @[@20,@50,@80,@70,@40]; - (void)drawRect:(CGRect)rect { // Drawing code #if 0 //贝塞尔路径 UIBezierPath *path = [UIBezier
阅读全文
posted @ 2016-08-28 23:08
Da雪山
阅读(243)
推荐(0)
摘要:
- (void)drawRect:(CGRect)rect { // Drawing code NSLog(@"drawRect自动调用"); //画图步骤 //获取上下文(/画笔/绘图环境) CGContextRef context = UIGraphicsGetCurrentContext();
阅读全文
posted @ 2016-08-28 22:55
Da雪山
阅读(1732)
推荐(0)
摘要:
1.使用 scheduledTimerWithTimeInterval:invocation:repeats: 或者scheduledTimerWithTimeInterval:target:selector:userInfo:repeats: 这两个类方法创建一个timer并把它指定到一个默认的r
阅读全文
posted @ 2016-08-28 21:41
Da雪山
阅读(218)
推荐(0)
摘要:
#pragma mark 1开关 - (void)createSwitch{ UISwitch *sw = [[UISwitch alloc]initWithFrame:CGRectMake(0, 70, 200, 40)]; sw.tintColor = [UIColor redColor]; s
阅读全文
posted @ 2016-08-28 18:33
Da雪山
阅读(226)
推荐(0)
摘要:
1.点击 UITapGestureRecognizer *tapGes = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapGR:)]; tapGes.numberOfTouchesRequired = 1
阅读全文
posted @ 2016-08-28 17:17
Da雪山
阅读(338)
推荐(0)
摘要:
可参考高德指南 http://lbs.amap.com/api/ios-location-sdk/guide/create-project/cocoapods 参考: http://blog.devtang.com/2014/05/25/use-cocoapod-to-manage-ios-lib-
阅读全文
posted @ 2016-08-28 13:59
Da雪山
阅读(299)
推荐(0)
摘要:
例子:http://www.jianshu.com/p/9ffcdc0003e0 下面研究下AttributedString究竟可以设置哪些属性,具体来说,有以下21个: // NSFontAttributeName 设置字体属性,默认值:字体:Helvetica(Neue) 字号:12 // NS
阅读全文
posted @ 2016-08-28 10:11
Da雪山
阅读(632)
推荐(0)
摘要:
#import <AVFoundation/AVFoundation.h> //基于这个框架 #import <AssetsLibrary/AssetsLibrary.h> //用于写入相册 @interface ViewController ()<UIGestureRecognizerDelega
阅读全文
posted @ 2016-08-25 22:56
Da雪山
阅读(546)
推荐(0)
摘要:
#pragma mark 截屏并保存至相册 -(void)screenShotsComplete:(void(^)(UIImage * img)) complete { CGSize imageSize = [[UIScreen mainScreen] bounds].size; UIGraphic
阅读全文
posted @ 2016-08-24 17:54
Da雪山
阅读(411)
推荐(0)
摘要:
1.导入系统库 #import <MobileCoreServices/MobileCoreServices.h> 2.遵守协议 <UIImagePickerControllerDelegate,UINavigationControllerDelegate> 3.创建 #pragma mark 相机
阅读全文
posted @ 2016-08-23 23:07
Da雪山
阅读(1501)
推荐(0)
摘要:
func loadData() { let urlString = baseURL + NewsListURL + "\(self.page)"+"/20" print(urlString) let url:URL = URL.init(string: urlString)!; let reques
阅读全文
posted @ 2016-06-24 15:12
Da雪山
阅读(363)
推荐(0)
摘要:
import UIKit class ViewController: UIViewController { //静态变量 swift中的static静态变量,只能在这里声明,不能在方法中声明,会报错 static var i : Int = 1 override func viewDidLoad()
阅读全文
posted @ 2016-06-16 15:11
Da雪山
阅读(6320)
推荐(0)
摘要:
//工具类单例 static let goods : NHGoods = { let good = NHGoods() return good }() //懒加载 lazy var registerBtn: UIButton = { var btn = UIButton.init(frame: CG
阅读全文
posted @ 2016-06-15 18:12
Da雪山
阅读(405)
推荐(0)
摘要:
1.声明协议 protocol SecondDelagate { func sendValue(text : String!) -> Void } 2.声明代理属性 var delegate : SecondValue! 3.调用代理方法 self.delegate.sendValue(textFi
阅读全文
posted @ 2016-06-15 10:50
Da雪山
阅读(165)
推荐(0)
摘要:
<1>闭包的声明(别名) typealias myBlock : (text : String!) -> Void <2>声明闭包属性 var block : myBlock! <3>实现闭包 (在其他类中) nextVC.block = {text in self.label!.text = te
阅读全文
posted @ 2016-06-15 10:37
Da雪山
阅读(191)
推荐(0)
摘要:
一.构造函数 //当一个类实例化一个对象时候,第一个调用的方法 class Student { //属性 var name = "ser" let age : Int //1.重写构造函数 //2.不带外部名的构造器参数 init(){ print("init") self.age = 111 //
阅读全文
posted @ 2016-06-14 20:07
Da雪山
阅读(221)
推荐(0)
摘要:
//1.定义一个基类 class Person { var name : String = "" //方法 func eat() -> Void { print("父类") } //不许子类重写的方法 关键字 final func run() ->Void{ print("run") } } 注意:
阅读全文
posted @ 2016-06-14 20:00
Da雪山
阅读(174)
推荐(0)
摘要:
一、使用 可选链式 调用代替强制展开 //当声明一个属性时,将属性类型设置为可选类型: 好处: 当可选类型的属性被赋予初始值时,系统调用初始值;当可选类型属性没有赋予初始值时,系统只会调用失败;如果属性强制展开,就会崩溃 // 如果属性为一般类型,则必须赋予初始值 struct Point { va
阅读全文
posted @ 2016-06-14 19:45
Da雪山
阅读(158)
推荐(0)
摘要:
一. 引用类型 类 在类中定义方法 class Person { //属性 var name : String = "" //方法 //实例方法 : 在类里面创建一个方法 func eat (a : Int) -> Void { print(a) } //方法的局部参数名称和外部参数名称 //默认参
阅读全文
posted @ 2016-06-14 19:34
Da雪山
阅读(371)
推荐(0)