- iOS 苹果健康-睡眠
蛋黄他爹
ios
直接上代码吧api如下api如下HKCategoryType*sleep1=[HKCategoryTypecategoryTypeForIdentifier:HKCategoryTypeIdentifierSleepAnalysis];//睡眠分析NSSet*healthSet=[NSSetsetWithObjects:sleep1,nil];//向系统的健康APP请求数据,并回调结果[self.
- 泛型
阶梯
touch方法,我们并不陌生,但是(NSSet*)touches,你是否好奇过,这个是怎么个写法,这就是泛型-(void)touchesCancelled:(NSSet*)toucheswithEvent:(UIEvent*)event;泛型:限制类型一:泛型使用场景1、在集合(数组,字典,NSSet)中使用泛型比较常见。2、当声明一个类,类里面的某些属性的类型不确定,这时候我们才使用泛型。eg:
- iOS开发遍历集合(NSArray,NSDictionary、NSSet)方法总结
kadis
iOS开发遍历集合(NSArray,NSDictionary、NSSet)方法总结尊重知识,转发请注明出处:iOS开发遍历集合方法总结想到循环遍历数组、字典这些常见的集合,大家脑子里第一反应就是for循环和快速遍历,并津津乐道的传承使用着这些方法,这些已经足够满足开发中所有类似的需求,似乎没有什么需要总结的,其实不然,不信往下看,知道的大神就不要浪费时间了。第一种方式:for循环Objective
- iOS 数组集合操作(交集,并集,差集,子集)
num_one
求数组的交集,并集,差集NSArray*array1=@[@"1",@"2",@"3"];NSArray*array2=@[@"1",@"5",@"6"];NSMutableSet*set1=[NSMutableSetsetWithArray:array1];NSMutableSet*set2=[NSMutableSetsetWithArray:array2];[set1unionSet:set2
- 第二更 NSSet类型 以及与NSArray区别
RunningTeemo
NSSet到底什么类型,其实它和NSArray功能性质一样,用于存储对象,属于集合;NSSet,NSMutableSet类声明编程接口对象,无序的集合,在内存中存储方式是不连续的,不像NSArray(是有序的集合)类声明编程接口对象是有序集合,在内存中存储位置是连续的;SSet和我们常用NSArry区别是:在搜索一个一个元素时NSSet比NSArray效率高,主要是它用到了一个算法hash(散列,
- 动态获取数组里面的莫一个元素
iOS_zeng
NSArray*array=[[NSArrayalloc]initWithObjects:@"1",@"2",@"3",nil];NSMutableSet*randomSet=[[NSMutableSetalloc]init];while([randomSetcount]<1){intr=arc4random()%[arraycount];[randomSetaddObject:[arrayobj
- UIAlertController添加输入框并监听输入内容控制按钮是否可点击
跃文
-(void)touchesBegan:(NSSet*)toucheswithEvent:(UIEvent*)event{__weakUIAlertController*alertC=[UIAlertControlleralertControllerWithTitle:@"请输入密码"message:@"输入提示"preferredStyle:UIAlertControllerStyleAlert
- iOS触摸事件、手势识别原理
西门吹雪V
触摸发生时,UIWindow会有一个队列来存放所有的触摸事件,然后再把这些事件发送给对应的hit-testview,hit-testview会通过touch的四个函数来接收这些事件。四个函数分别为:(began,move,end,cancel)//touchesmethod-(void)touchesBegan:(NSSet*)toucheswithEvent:(UIEvent*)event{NS
- OC------集合概述
付闯688
数据结构
目录7.4Objective-C集合概述7.5数组(NSArray与NSMutableArray)NSarray的功能与用法对集合元素整体调用方法对NSArray进行排序使用枚举器遍历NSArray集合元素快速枚举(for...in)可变数组(NSMutableArray)NSArray的KVC与KFC7.6集合(NSSet和NSMutableSet)NNSet的功能与用法NSSst判断集合元素重
- iOS判断当前点击的位置是否在某个视图上的几种方法
陈大帅
转自ericshen880412iOS判断当前点击的位置是否在某个视图上记录几种判断触摸点是否在某个view上面的方法第一种方式:isDescendantOfView:通过touch.view调用isDescendantOfView:方法,返回YES,则触摸点在我们需要判断的视图上;反之则不在-(void)touchesBegan:(NSSet*)toucheswithEvent:(UIEvent
- OC - 点击空白处隐藏键盘
Timidvb
IQKeyboardManager是肯定要加的了,其次就是点击空白处隐藏键盘。在view中重写touchesBegan方法-(void)touchesBegan:(NSSet*)toucheswithEvent:(UIEvent*)event{[userNameTextFieldresignFirstResponder];[passwordTextFieldresignFirstResponder
- KVC底层实现
泰克2008
一、关于valueForKey:key的调用顺序1、先调用相关方法,先后顺序是|-getter方法:getKey->key->isKey|-NSArray方法:countOfKey和objectInKeyAtIndex或者keyAtIndexes|-NSSet方法:countOfKey和其他两种方法2、如果没有相关方法,看+(BOOL)accessInstanceVariablesDirectly
- ios ~ 手指在view或window上的位置 x、y
阳光下的叶子呵
获取手指在某一个UIView上的具体位置:point.x、point.y所求的自定义view:self.lineLayerRangeView-(void)touchesBegan:(NSSet*)toucheswithEvent:(nullableUIEvent*)event{UITouch*touch=touches.anyObject;CGPointpoint=[touchlocationIn
- iOS 中深浅拷贝详解
sunnyxg0812
先上个图注意:其他对象NSArray、NSMutableArray、NSDictionary、NSMutableDictionary、NSSet、NSMutableSet、NSNumber一样适用image浅拷贝这个概念相比很好理解,直接看图吧。image浅拷贝:指针拷贝,复制一个新的指针,只想同一块内存区域。实际内存并没有发生拷贝深拷贝image深拷贝:内容拷贝,拷贝数据到一块新内存区域,指针指
- iOS-任务依赖-while
笑破天
NSOperation、dispatch_semaphore_t、子线程while子线程while:-(void)viewDidLoad{[superviewDidLoad];queue=dispatch_queue_create("com.xx.test",DISPATCH_QUEUE_SERIAL);[selftest];}-(void)touchesBegan:(NSSet*)touches
- iOS 获取点击顶部状态栏的事件
晴朗Nic
以iOS13为分水岭,iOS13之前和之后获取点击状态栏的事件不一样iOS13以前例如:iOS12、iOS11、iOS10获取状态栏点击事件在AppDelegate添加以下代码///iOS13以下用来监听店家状态栏的方法-(void)touchesBegan:(NSSet*)toucheswithEvent:(UIEvent*)event{[supertouchesBegan:toucheswit
- 浅谈对象的 copy 与 mutableCopy 方法的区别
T_guo
不管是集合类对象(NSArray、NSDictionary、NSSet...之类的对象),还是非集合类对象(NSString,NSNumber...之类的对象),接收到copy和mutableCopy消息时,都遵循以下准则:1.copy返回的是不可变对象(immutableObject);如果用copy返回值调用mutable对象的方法就会crash。2.mutableCopy返回的是可变对象(m
- 对象等同性之isEqual和hash
GemShi
问题引入用集合过滤重复元素NSString*str1=@"helloworld";NSString*str2=[NSStringstringWithFormat:@"%@",@"helloworld"];NSMutableSet*s=[[NSMutableSetalloc]init];[saddObject:str1];[saddObject:str2];/*{("helloworld")}*/如
- 点击view空白处做处理(隐藏键盘或隐藏视图)
丶小裤头灬
点击视图空白处隐藏键盘,销毁视图等等,可以用以下方法-(void)touchesBegan:(NSSet*)toucheswithEvent:(UIEvent*)event{//dosomthing[textFiledresignFirstResponder];//隐藏键盘}
- OC 数组分组
三少爷_贱
NSMutableSet*set=[NSMutableSetset];NSMutableArray*array=[[NSMutableArrayalloc]init];//self.signInModel.rewards是一个数组[self.signInModel.rewardsenumerateObjectsUsingBlock:^(SignInRewardsModel*_Nonnullobj,
- 404,深拷贝和浅拷贝的区别(面试点:非集合类(NSString,NSNumber)结论:不可变进行copy是浅复制,mutableCopy是深复制,可变的copy,mutableCopy都是深...
枫叶1234
OC中copy和mutableCopy的详细用法首先我们要先明白一个概念,什么是浅复制,单层深复制,完全复制(每一层都深复制)浅复制也就是所说的指针复制,并没有进行对象复制单层深复制,也就是我们经常说的深复制,我这里说的单层深复制是对于集合类所说的(即NSArray,NSDictionary,NSSet),单层深复制指的是只复制了该集合类的最外层,里边的元素没有复制,(即这两个集合类的地址不一样,
- 2022 iOS 内购详解最新最全In-App Purchase(附代码)
请叫我作家
学如逆水行舟,不进则退。今天和大家来聊聊iOS内购即In-AppPurchase,内购分为消耗型、非消耗型、自动订阅、非自动订阅型。内购流程配置App内购买项目(可以参考苹果官方文档)在iTC后台接收付费协议创建App内购买项目创建沙盒账号,用于测试代码实现从苹果请求商品详情-(void)requestIAPProducts:(NSSet*)productIds{SKProductsRequest
- 新版xcode新建项目 删除Scenedelegate
会敲代码的小熊猫
1:到info.plist删除ApplicationSceneManifest选项;2:删掉Scenedelegate.h和Scenedelegate.m这两个文件;3:AppDelegate里删掉-(void)application:(UIApplication*)applicationdidDiscardSceneSessions:(NSSet*)sceneSessions{}-(UIScen
- 614,IOS数组线程安全(面试点:在数组的地方,添加,删除,替换,插入都用栅栏函数)
枫叶1234
概述为什么会有数组的线程安全问题?对于可变的集合(NSMutableArray、NSMutableDictionary、NSMutableSet)是可读可写的,所以有可能出现这种场景:两个或多个线程同时对一个可变集合进行读、写、新增及删除的操作,这样是得不到预期的结果的,甚至程序会抛出异。如果我们将这些线程用一定的规则去管理好,那就可以解决这个问题了。下面我们开始着手处理这个问题吧先修要解决这个线
- 手势和事件冲突的事件传递
zaijianbali
···(void)touchesBegan:(NSSet*)toucheswithEvent:(UIEvent*)event{NSLog(@"touchesBegan");}(void)touchesMoved:(NSSet*)toucheswithEvent:(UIEvent*)event{NSLog(@"touchesMoved");}(void)touchesCancelled:(NSSet
- iOS官方文档 Foundation篇---NSEnumerator
qianfei
NSEnumerator一个抽象类,其子类枚举对象集合,例如数组和字典。继承自NSObject;所有的集合类,如NSArray,NSSet和NSDictionary提供特殊的NSEnumerator与枚举其内容的对象。例如,NSArray有两个返回NSEnumerator对象的方法:objectEnumerator和reverseObjectEnumerator;NSDictionary也有两个返
- NSHashTable:NSMutableSet 的替代品?
溪石iOS
NSHashTable解决了什么问题使用NSMutableSet时,主要有两个让开发者如鲠在喉的地方:加入NSMutableSet的只能是对象,还必须得实现NSCopy协议;NSMutableSet强引用对象,这在某些场景下导致内存泄漏。苹果当然也发现了这些问题,于是iOS6.0以后,推出NSHashTable,从此我们可以这样:lethashTable=NSHashTable.init(opti
- 清除WKWebview的cookie
Felix的笔头
-(void)deleteWebCookiesCache:(NSString*)strUrl{if(@available(iOS9.0,*)){//iOS9及以上NSArray*types=@[WKWebsiteDataTypeCookies,WKWebsiteDataTypeSessionStorage];NSSet*websiteDataTypes=[NSSetsetWithArray:typ
- Block、Protocol、结构体、NSString、NSArray、NSFileManager、NSSet、NSDictionary、NSNumber、NSDate、NSValue
Andy_Livings
收集Block、Protocol、结构体、NSString、NSArray、NSFileManager、NSSet、NSDictionary、NSNumber、NSDate、NSValue等的基本用法。Blockblock要掌握的东西1>如何定义block变量int(^sumBlock)(int,int);void(^myBlock)();2>如何利用block封装代码^(inta,intb){r
- AFNetworking 数组参数(合并数组)
筱笑
将需要的传的数组转化成NSSet集合。NSArray*arr1=@[@"11",@"22"];NSArray*arr2=@[@"33",@"44"];//两个数组合并成一个数组NSArray*zongArr=[arr1arrayByAddingObjectsFromArray:arr2];NSLog(@"zongArr=%@",zongArr);NSSet*arrSet=[NSSetsetWith
- github中多个平台共存
jackyrong
github
在个人电脑上,如何分别链接比如oschina,github等库呢,一般教程之列的,默认
ssh链接一个托管的而已,下面讲解如何放两个文件
1) 设置用户名和邮件地址
$ git config --global user.name "xx"
$ git config --global user.email "
[email protected]"
- ip地址与整数的相互转换(javascript)
alxw4616
JavaScript
//IP转成整型
function ip2int(ip){
var num = 0;
ip = ip.split(".");
num = Number(ip[0]) * 256 * 256 * 256 + Number(ip[1]) * 256 * 256 + Number(ip[2]) * 256 + Number(ip[3]);
n
- 读书笔记-jquey+数据库+css
chengxuyuancsdn
htmljqueryoracle
1、grouping ,group by rollup, GROUP BY GROUPING SETS区别
2、$("#totalTable tbody>tr td:nth-child(" + i + ")").css({"width":tdWidth, "margin":"0px", &q
- javaSE javaEE javaME == API下载
Array_06
java
oracle下载各种API文档:
http://www.oracle.com/technetwork/java/embedded/javame/embed-me/documentation/javame-embedded-apis-2181154.html
JavaSE文档:
http://docs.oracle.com/javase/8/docs/api/
JavaEE文档:
ht
- shiro入门学习
cugfy
javaWeb框架
声明本文只适合初学者,本人也是刚接触而已,经过一段时间的研究小有收获,特来分享下希望和大家互相交流学习。
首先配置我们的web.xml代码如下,固定格式,记死就成
<filter>
<filter-name>shiroFilter</filter-name>
&nbs
- Array添加删除方法
357029540
js
刚才做项目前台删除数组的固定下标值时,删除得不是很完整,所以在网上查了下,发现一个不错的方法,也提供给需要的同学。
//给数组添加删除
Array.prototype.del = function(n){
- navigation bar 更改颜色
张亚雄
IO
今天郁闷了一下午,就因为objective-c默认语言是英文,我写的中文全是一些乱七八糟的样子,到不是乱码,但是,前两个自字是粗体,后两个字正常体,这可郁闷死我了,问了问大牛,人家告诉我说更改一下字体就好啦,比如改成黑体,哇塞,茅塞顿开。
翻书看,发现,书上有介绍怎么更改表格中文字字体的,代码如下
 
- unicode转换成中文
adminjun
unicode编码转换
在Java程序中总会出现\u6b22\u8fce\u63d0\u4ea4\u5fae\u535a\u641c\u7d22\u4f7f\u7528\u53cd\u9988\uff0c\u8bf7\u76f4\u63a5这个的字符,这是unicode编码,使用时有时候不会自动转换成中文就需要自己转换了使用下面的方法转换一下即可。
/**
* unicode 转换成 中文
- 一站式 Java Web 框架 firefly
aijuans
Java Web
Firefly是一个高性能一站式Web框架。 涵盖了web开发的主要技术栈。 包含Template engine、IOC、MVC framework、HTTP Server、Common tools、Log、Json parser等模块。
firefly-2.0_07修复了模版压缩对javascript单行注释的影响,并新增了自定义错误页面功能。
更新日志:
增加自定义系统错误页面功能
- 设计模式——单例模式
ayaoxinchao
设计模式
定义
Java中单例模式定义:“一个类有且仅有一个实例,并且自行实例化向整个系统提供。”
分析
从定义中可以看出单例的要点有三个:一是某个类只能有一个实例;二是必须自行创建这个实例;三是必须自行向系统提供这个实例。
&nb
- Javascript 多浏览器兼容性问题及解决方案
BigBird2012
JavaScript
不论是网站应用还是学习js,大家很注重ie与firefox等浏览器的兼容性问题,毕竟这两中浏览器是占了绝大多数。
一、document.formName.item(”itemName”) 问题
问题说明:IE下,可以使用 document.formName.item(”itemName”) 或 document.formName.elements ["elementName&quo
- JUnit-4.11使用报java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing错误
bijian1013
junit4.11单元测试
下载了最新的JUnit版本,是4.11,结果尝试使用发现总是报java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing这样的错误,上网查了一下,一般的解决方案是,换一个低一点的版本就好了。还有人说,是缺少hamcrest的包。去官网看了一下,如下发现:
- [Zookeeper学习笔记之二]Zookeeper部署脚本
bit1129
zookeeper
Zookeeper伪分布式安装脚本(此脚本在一台机器上创建Zookeeper三个进程,即创建具有三个节点的Zookeeper集群。这个脚本和zookeeper的tar包放在同一个目录下,脚本中指定的名字是zookeeper的3.4.6版本,需要根据实际情况修改):
#!/bin/bash
#!!!Change the name!!!
#The zookeepe
- 【Spark八十】Spark RDD API二
bit1129
spark
coGroup
package spark.examples.rddapi
import org.apache.spark.{SparkConf, SparkContext}
import org.apache.spark.SparkContext._
object CoGroupTest_05 {
def main(args: Array[String]) {
v
- Linux中编译apache服务器modules文件夹缺少模块(.so)的问题
ronin47
modules
在modules目录中只有httpd.exp,那些so文件呢?
我尝试在fedora core 3中安装apache 2. 当我解压了apache 2.0.54后使用configure工具并且加入了 --enable-so 或者 --enable-modules=so (两个我都试过了)
去make并且make install了。我希望在/apache2/modules/目录里有各种模块,
- Java基础-克隆
BrokenDreams
java基础
Java中怎么拷贝一个对象呢?可以通过调用这个对象类型的构造器构造一个新对象,然后将要拷贝对象的属性设置到新对象里面。Java中也有另一种不通过构造器来拷贝对象的方式,这种方式称为
克隆。
Java提供了java.lang.
- 读《研磨设计模式》-代码笔记-适配器模式-Adapter
bylijinnan
java设计模式
声明: 本文只为方便我个人查阅和理解,详细的分析以及源代码请移步 原作者的博客http://chjavach.iteye.com/
package design.pattern;
/*
* 适配器模式解决的主要问题是,现有的方法接口与客户要求的方法接口不一致
* 可以这样想,我们要写这样一个类(Adapter):
* 1.这个类要符合客户的要求 ---> 那显然要
- HDR图像PS教程集锦&心得
cherishLC
PS
HDR是指高动态范围的图像,主要原理为提高图像的局部对比度。
软件有photomatix和nik hdr efex。
一、教程
叶明在知乎上的回答:
http://www.zhihu.com/question/27418267/answer/37317792
大意是修完后直方图最好是等值直方图,方法是HDR软件调一遍,再结合不透明度和蒙版细调。
二、心得
1、去除阴影部分的
- maven-3.3.3 mvn archetype 列表
crabdave
ArcheType
maven-3.3.3 mvn archetype 列表
可以参考最新的:http://repo1.maven.org/maven2/archetype-catalog.xml
[INFO] Scanning for projects...
[INFO]
- linux shell 中文件编码查看及转换方法
daizj
shell中文乱码vim文件编码
一、查看文件编码。
在打开文件的时候输入:set fileencoding
即可显示文件编码格式。
二、文件编码转换
1、在Vim中直接进行转换文件编码,比如将一个文件转换成utf-8格式
&
- MySQL--binlog日志恢复数据
dcj3sjt126com
binlog
恢复数据的重要命令如下 mysql> flush logs; 默认的日志是mysql-bin.000001,现在刷新了重新开启一个就多了一个mysql-bin.000002
- 数据库中数据表数据迁移方法
dcj3sjt126com
sql
刚开始想想好像挺麻烦的,后来找到一种方法了,就SQL中的 INSERT 语句,不过内容是现从另外的表中查出来的,其实就是 MySQL中INSERT INTO SELECT的使用
下面看看如何使用
语法:MySQL中INSERT INTO SELECT的使用
1. 语法介绍
有三张表a、b、c,现在需要从表b
- Java反转字符串
dyy_gusi
java反转字符串
前几天看见一篇文章,说使用Java能用几种方式反转一个字符串。首先要明白什么叫反转字符串,就是将一个字符串到过来啦,比如"倒过来念的是小狗"反转过来就是”狗小是的念来过倒“。接下来就把自己能想到的所有方式记录下来了。
1、第一个念头就是直接使用String类的反转方法,对不起,这样是不行的,因为Stri
- UI设计中我们为什么需要设计动效
gcq511120594
UIlinux
随着国际大品牌苹果和谷歌的引领,最近越来越多的国内公司开始关注动效设计了,越来越多的团队已经意识到动效在产品用户体验中的重要性了,更多的UI设计师们也开始投身动效设计领域。
但是说到底,我们到底为什么需要动效设计?或者说我们到底需要什么样的动效?做动效设计也有段时间了,于是尝试用一些案例,从产品本身出发来说说我所思考的动效设计。
一、加强体验舒适度
嗯,就是让用户更加爽更加爽的用
- JBOSS服务部署端口冲突问题
HogwartsRow
java应用服务器jbossserverEJB3
服务端口冲突问题的解决方法,一般修改如下三个文件中的部分端口就可以了。
1、jboss5/server/default/conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
2、./server/default/deploy/jbossweb.sar/server.xml
3、.
- 第三章 Redis/SSDB+Twemproxy安装与使用
jinnianshilongnian
ssdbreidstwemproxy
目前对于互联网公司不使用Redis的很少,Redis不仅仅可以作为key-value缓存,而且提供了丰富的数据结果如set、list、map等,可以实现很多复杂的功能;但是Redis本身主要用作内存缓存,不适合做持久化存储,因此目前有如SSDB、ARDB等,还有如京东的JIMDB,它们都支持Redis协议,可以支持Redis客户端直接访问;而这些持久化存储大多数使用了如LevelDB、RocksD
- ZooKeeper原理及使用
liyonghui160com
ZooKeeper是Hadoop Ecosystem中非常重要的组件,它的主要功能是为分布式系统提供一致性协调(Coordination)服务,与之对应的Google的类似服务叫Chubby。今天这篇文章分为三个部分来介绍ZooKeeper,第一部分介绍ZooKeeper的基本原理,第二部分介绍ZooKeeper
- 程序员解决问题的60个策略
pda158
框架工作单元测试
根本的指导方针
1. 首先写代码的时候最好不要有缺陷。最好的修复方法就是让 bug 胎死腹中。
良好的单元测试
强制数据库约束
使用输入验证框架
避免未实现的“else”条件
在应用到主程序之前知道如何在孤立的情况下使用
日志
2. print 语句。往往额外输出个一两行将有助于隔离问题。
3. 切换至详细的日志记录。详细的日
- Create the Google Play Account
sillycat
Google
Create the Google Play Account
Having a Google account, pay 25$, then you get your google developer account.
References:
http://developer.android.com/distribute/googleplay/start.html
https://p
- JSP三大指令
vikingwei
jsp
JSP三大指令
一个jsp页面中,可以有0~N个指令的定义!
1. page --> 最复杂:<%@page language="java" info="xxx"...%>
* pageEncoding和contentType:
> pageEncoding:它