- 博客(29)
- 收藏
- 关注
转载 为什么说 Objective-C 没有私有方法和私有变量
为什么说 Objective-C 没有私有方法和私有变量之前在某个地方看到说 Objective-C 并没有绝对的私有变量和私有方法。开始挺纳闷的。我们在 .m 中实现的方法,不在.h 中声明,外界不就不能访问到了吗?首先,我们先来看一下私有的定义:私有是指只能够在本类内部使用或访问,但是不能在类的外部被访问。看起来好像没有什么问题,不过以下的几种方式的确打破了上面的规则。
2016-12-09 16:24:13
1491
转载 iOS 网络请求设置https连接方式
// 1.初始化单例类 AFHTTPSessionManager *manager = [AFHTTPSessionManagermanager]; // SSLPinningMode // 2.设置证书模式 NSString * cerPath = [[NSBundlemainBundle] pathForResource:@"x
2016-12-05 14:53:15
843
原创 js深拷贝和浅拷贝
js深拷贝和浅拷贝一、数组的深浅拷贝在使用JavaScript对数组进行操作的时候,我们经常需要将数组进行备份,事实证明如果只是简单的将它赋予其他变量,那么我们只要更改其中的任何一个,然后其他的也会跟着改变,这就导致了问题的发生。var arr = ["One","Two","Three"];var arrto = arr;arrto[1] = "test";doc
2016-11-10 15:50:47
265
原创 iOS 计算webview高度
#import "SubjectViewController.h"@interface SubjectViewController ()@property(nonatomic, strong)UIWebView *webView;@end@implementation SubjectViewController- (void)viewDidLoad { [super viewDidLoad]; s
2016-09-01 14:28:49
636
原创 react-native 水平ListView
用react-native实现水平方向listView,滚动时计算ListView的contentOffset github地址: https://github.com/leicunjie/horizontal-ListView主要代码如下:/** * Sample React Native App * https://github.com/facebook/react
2016-08-10 12:45:23
3366
原创 生成main.jsbundle命令
curl http://localhost:8081/index.ios.bundle -o main.jsbundle
2016-07-30 15:45:01
1082
原创 react-native ScrollView的简单应用
import React, { Component } from 'react';import { AppRegistry, StyleSheet, Text, View, ScrollView, Dimensions,} from 'react-native';import QuestionItem from './QuestionItem';var questionData = { title
2016-07-26 16:56:16
605
原创 react-native缓存数据
'use strict';import React, { Component } from 'react';import { AppRegistry, NavigatorIOS, StyleSheet, ListView, View, Text, TouchableHighlight, Alert,
2016-07-14 16:58:35
8231
原创 iOS判断某个类是否释放
Class object_getClass(id object); Class newClass = object_getClass(strongSelf); if(strongSelf != newClass){ return ;//已经释放
2016-07-12 16:02:35
2010
原创 iOS在原有项目中使用react
1. 在Podfile中添加:pod 'React', :path => './node_modules/react-native', :subspecs => [ 'Core', 'RCTImage', 'RCTNetwork', 'RCTText', 'RCTWebSocket', # Add any other subspecs you want to
2016-07-07 10:15:34
331
原创 react调用原生iOS方法
/*OC...................................//// ViewController.m// ReactNativeLearn//// Created by leicunjie on 16/7/6.// Copyright © 2016年 Facebook. All rights reserved.//
2016-07-06 19:08:54
1490
原创 React创建项目报错 Error: EACCES: permission denied, open '/Users/****/.babel.json'
fs.js:549 return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode); ^Error: EACCES: permission denied, open '/Users/leicunjie/.babel.json'
2016-07-05 11:40:39
5589
原创 tableView滚动到底部
weakSelf!.tableView.scrollToRowAtIndexPath(indexPath, atScrollPosition: .Bottom, animated: false)
2016-06-30 19:19:45
606
原创 启动react服务器命令
启动react服务器命令 sudo react-native start 运行模拟器 react-native run-ios
2016-06-28 17:45:32
3355
转载 swift 集合(Collection)类型的赋值和拷贝行为
swift 集合(Collection)类型的赋值和拷贝行为Swift 中数组(Array)和字典(Dictionary)类型均以结构体的形式实现。然而当数组被赋予一个常量或变量,或被传递给一个函数或方法时,其拷贝行为与字典和其它结构体有些许不同。以下对数组和结构体的行为描述与对NSArray和NSDictionary的行为描述在本质上不同,后者是以类的形式实现,前者是以结构体的形式实
2016-06-22 18:29:27
848
转载 UILabel设置行间距
UILabel设置行间距NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc]initWithString:contentLabel.text];; NSMutableParagraphStyle *paragraphStyle = [[N
2016-05-09 16:54:30
484
转载 一个合格的程序员应该读过哪些书
http://ezlippi.com/blog/2014/07/qualified-programmer-should-read-what-books.html
2016-05-05 23:45:32
290
原创 iOS 汉字转拼音
NSString *hanziText = @"天津"; if ([hanziText length]) { NSMutableString *ms = [[NSMutableStringalloc] initWithString:hanziText]; if (CFStringTransform((__bridgeCFMu
2016-05-04 16:18:40
265
转载 iOS App被拒原因
提交苹果审核App被拒原因(1)Information NeededWe began the review of your app but aren't able to continue because we need additional information about your app.At your earliest opportunity, plea
2016-05-03 19:27:28
10198
转载 ios系统中各种设置项的url链接
ios系统中各种设置项的url链接 在代码中调用如下代码:NSURL*url=[NSURL URLWithString:@"prefs:root=WIFI"];[[UIApplication sharedApplication] openURL:url];即可跳转到设置页面的对应项。[font=]About — prefs:root=General&path=Abo
2016-05-03 16:43:45
429
转载 iOS获取通话状态
#import #import [plain] view plaincopy -(void)detectCall { CTCallCenter *callCenter = [[CTCallCenter alloc] init]; callCenter.callEventHandler=^(CTCall* call
2016-04-17 12:37:00
1098
转载 获取UIWebView内容
获取所有html:NSString *lJs = @"document.documentElement.innerHTML";获取网页title:NSString *lJs2 = @"document.title"; thisURL = document.URL; thisHREF = document.location.href; thisSLoc = self.loc
2016-04-16 11:13:53
306
原创 iOS label设置内容为HTML
NSString * htmlstr =@"测试段落"; NSData *data = [htmlstrdataUsingEncoding:NSUnicodeStringEncoding]; NSDictionary *options =@{NSDocumentTypeDocumentAttribute:NSHTMLTextDocumentType};
2016-04-15 17:16:33
359
转载 iOS限制输入长度
[textField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];- (void)textFieldDidChange:(UITextField *)textField{ if (textField
2016-04-13 16:52:53
252
原创 iOS手势滑动返回
自定义返回按钮时:- (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; //代理置空,否则会闪退 if ([self.navigationController respondsToSelector:@selector(intera
2016-04-13 16:46:24
318
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人