自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

来自星星的の松子的博客

个人主页:lysongzi.com

  • 博客(87)
  • 收藏
  • 关注

原创 iOS - 内存管理十全大补丸——内存泄露检查实战总结

前段时间被分配查应用的内存泄露问题,然后搜集了一大波内存管理相关的资料,并且在整个过程中狠狠的实践了一波。下面就把这段时间内碰到的坑(从别的地方也搜刮到很多坑),以及搜集到的一些理论知识(简洁版)总结一发。  背景:一个复杂的iOS应用可能会混合着MRR和ARC两种内存管理方式,就是有一部分文件MRR实现,而另一部分则是ARC实现(原因目测是因为复用MRR实现的旧代码)。所以就存在一种现象,如果后来

2016-07-17 00:12:36 5782 1

原创 Google protocol buffer 使用和原理浅析 And 进阶使用方式之PbCodec

Google Protocol Buffer又简称Protobuf,它是一种很高效的结构化数据存储格式,一般用于结构化数据的串行化,简单说就是我们常说的数据序列化。这种序列化的协议非常轻便高效,而且是跨平台的,目前已支持多种主流语言(3.0版本支持C++, JAVA, C#, OC, GO, PYTHON等)。

2016-07-03 17:04:12 10389

原创 iOS-监听UITextField值改变事件

在实际情况中我们有时候在界面输入时候需要让用户输入的数据与模型同步,那么可能我们就需要监听UITextField值改变事件,然后在响应的方法中将新的值同步到模型中。这次我们主要提出三种方案,其中第一种方案是不一定有效的,后两种方案则是比较可靠的方案。一、实现UITextFieldDelegate协议。  这种方式实际上是由系统空间回调协议中的方式,并且通过查阅文档我们可以发现有以下相关接口是相关的。

2016-06-06 22:00:33 10687

原创 iOS-Effective Objective-C 2.0 读书笔记(三)

第三章的内容主要是说接口和API设计相关的注意事项。比如说我们自己写的代码需要设计以便于代码复用时,应该注意的一些问题包括哪些。简单总结  有些注意事项实际上很简单,而且很常见,我觉得并不需要太长篇幅来解释说明大家也能理解,所以这里主要以归纳的形式列出。

2016-04-29 22:31:34 652

原创 LeetCode - Word Pattern

QuestionLink : https://leetcode.com/problems/word-pattern/Given a pattern and a string str, find if str follows the same pattern.Here follow means a full match, such that there is a bijection between a

2016-04-28 23:46:46 357

原创 iOS-Effective Objective-C 2.0 读书笔记(二)

哈哈,上一篇可以参考。这一章主要是涉及对象、消息和运行期的一些相关特性。第7条 在对象的内部尽量直接访问实例变量  我们都知道使用了属性之后,可以通过存取方法来访问相关实例变量,也可以直接访问实例变量。

2016-04-24 15:52:46 557

原创 LeetCode - Reverse Vowels of a String

QuestionLink : https://leetcode.com/problems/reverse-vowels-of-a-string/Write a function that takes a string as input and reverse only the vowels of a string.

2016-04-23 23:33:20 548

原创 iOS-Effective Objective-C 2.0 读书笔记(一)

今天开始看了Effective Objective-C 2.0的一部分内容,然后打算记录下来一些其中提到的比较有用的注意点,然后在之后的实际开发过程中能有所规避,写出更好的代码。

2016-04-23 16:02:58 624

原创 LeetCode - Reverse String

QuestionLink : https://leetcode.com/problems/reverse-string/Write a function that takes a string as input and returns the string reversed.Example: Given s = “hello”, return “olleh”.

2016-04-22 23:11:23 420

原创 LeetCode - Ugly Number

QuestionLink : Write a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5.

2016-04-21 11:43:17 308

原创 LeetCode - Power of Three

Given an integer, write a function to determine if it is a power of three.

2016-04-21 11:15:29 310

原创 LeetCode - Nim Game

QuestionLink : https://leetcode.com/problems/nim-game/You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 s

2016-04-19 22:52:01 656

原创 LeetCode - Power of Four

QuestionLink : https://leetcode.com/problems/power-of-four/Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example: Given num = 16, return true. Given num

2016-04-19 22:21:39 367

原创 LeetCode - Majority Element

QuestionLink : https://leetcode.com/problems/majority-element/Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.

2016-04-16 23:45:52 260

原创 LeetCode - ZigZag Conversion

QuestionLink : https://leetcode.com/problems/zigzag-conversion/The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this...

2016-04-16 22:51:39 255

原创 LeetCode - Binary Tree Level Order Traversal

QuestionGiven a binary tree, return the level order traversal of its nodes’ values. (ie, from left to right, level by level).

2016-04-14 20:42:35 258

原创 LeetCode - Delete Node in a Linked List

QuestionLink : https://leetcode.com/problems/delete-node-in-a-linked-list/Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.

2016-04-14 20:13:29 261

原创 LeetCode - Best Time to Buy and Sell Stock

QuestionLink : https://leetcode.com/problems/best-time-to-buy-and-sell-stock/Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complet

2016-04-13 15:31:36 245

原创 LeetCode - Balanced Binary Tree

QuestionGiven a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never di

2016-04-13 14:34:33 249

原创 LeetCode - Add Binary

QuestionLink:https://leetcode.com/problems/add-binary/ Given two binary strings, return their sum (also a binary string).

2016-04-11 19:52:59 334

原创 LeetCode - Add Digits

QuestionLink:https://leetcode.com/problems/add-digits/ Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.

2016-04-11 18:58:38 263

原创 LeetCode - Add Two Numbers

QuestionLink:https://leetcode.com/problems/add-two-numbers/ You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain

2016-04-11 17:45:13 304

原创 LeetCode - Two Sum

QuestionLink : https://leetcode.com/problems/two-sum/ Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have

2016-04-11 17:38:58 225

原创 国内某社交通讯大佬面试题(二)

面试时间:2016/04/07 坐标:上海 岗位:iOS开发实习生额。面试下午两点开始的。一开始给了一套笔试题。上面就三道题。我就凭记忆大概说一下。

2016-04-11 16:31:09 676

原创 iOS开源-图像缓存库LYImageCache

LYImageCache一个极简单的用于对UIImage图像数据进行缓存操作的库。 这个库的实现主要参考了SDWebImage中的图片缓存的实现。(大部分代码源于此,哈哈哈哈哈哈哈哈)… 目前只支持iOS平台(iOS 7.0及其以上),且需要启动ARC。一、说明缓存主要为内存缓存,还有可选的磁盘缓存方式。缓存可以指定磁盘缓存的目录。并提供一定的接口用于清除过期的缓存文件。PS: 本库乃是模

2016-03-27 15:33:25 374

原创 KVC/KVO的实现原理简述

一、KVCKVC全称为key-value coding,键值编码。就是提供了一种机制可以访问一个对象的任意属性。它是通过使用字符串作为关键字而不是使用setter/getter访问器去访问一个对象实例的属性的机制。1.1 实现原理:(问题:KVC是如何访问属性的) (1)如果是取值操作,检查是否存在-,-is,或者-get的对应key的访问器方法,如果有则调用这些方法。 如果是设值操作,检查是否

2016-03-25 20:57:26 1600

原创 iOS-RunLoop学习笔记

一直以来都听说过RunLoop这个东西,并且知道它是用来在某个线程中开启一种循环等待接受并处理事件状态的方法。然后好奇之下就查找了一些资料,然后发现了一篇大神对RunLoop的深入分析,看后大呼神奇!虽然看的不是很懂,好吧其实感觉看懂了皮毛而已,但是文章真的很不错,的确值得多看几次,细细品味!!!

2016-03-16 11:26:30 418

原创 iOS-绘图系统相关学习笔记(一)

绘图方面的知识 1.使用imageNamed:加载的图片会缓存在内存中,如果再次请求相同图片时则会直接返回图片。2.可以通过类方法imageWithContentsOfFile:或initWithContentsOfFile:来加载图片,不过这两种方式加载的图片不会缓存在内存中?!3.UIImageView实际上可以有两幅图片,一幅赋予image属性,另一幅赋予highlightedImage属性

2016-03-14 19:43:15 474

原创 iOS-使用URL Scheme实现App的进程间通信

iOS平台的进程间通信是一件很蛋疼的事,通过窝大量的资料搜索,最后发现好像比较普遍的实现方式则是使用URL Scheme(好吧好像别的方式我还没搞懂,准备看英文文献学习学习先哈哈哈哈哈)。

2016-03-13 16:19:26 7208

原创 iOS-UIApplicationDelegate学习笔记

UIApplicationDelegate协议定义了很多方法,这些方法将会在你的App的生命周期中发生重要的事件时被一个单例对象UIApplication所调用。该delegate的一些方法使得我们可以在应用状态发生变化时做一些处理操作。比如说,当应用从前台编导后台执行,就会有对应的方法被调用来响应该状态的变化。

2016-03-13 15:49:13 797

原创 国内某电商大佬面试题(二)

额。这是个电话二面,岗位客户端开发工程师。全程49min。哎,求人品啊!!!

2016-03-13 15:45:38 575

原创 排序算法-快速排序

快速排序使用分治法(Divide and conquer)策略来把一个序列(list)分为两个子序列(sub-lists)。

2016-03-11 13:09:33 365

原创 iOS-UIScrollview滑动时标题栏自动隐藏和显示效果

本文主要介绍如何实现当UIScrollview滑动时,自动隐藏和显示标题栏的效果。其中布局采用Autolayout的方式,并且为了代码精简,使用了第三方库Masonry,其使用参考【iOS-Masonry学习笔记】。使用它的原因是可以很好的结合动画效果的实现!

2016-03-11 12:55:56 3140

转载 Objective-C Runtime 一小时入门教程(下)

来源:ian(@ianisme) 链接:http://www.ianisme.com/ios/2019.html类的归档篇苍老师的资料总要整理一下吧! 创建People.h#import <Foundation/Foundation.h>@interface People : NSObject <NSCoding>@property (nonatomic, copy) NSString

2016-03-07 16:58:44 498

转载 Objective-C Runtime 一小时入门教程(中)

获取类的成员变量和属性篇苍老师在大家心目中应该有很多特征吧,下面我们通过代码来获取苍老师的特征。

2016-03-07 16:50:14 331

原创 排序算法-希尔排序

一、介绍  希尔排序,也称递减增量排序算法,是插入排序的一种更高效的改进版本。希尔排序是非稳定排序算法。

2016-03-07 16:38:04 302

原创 排序算法-基数排序

基数排序(英语:Radix sort)是一种非比较型整数排序算法,其原理是将整数按位数切割成不同的数字,然后按每个位数分别比较。

2016-03-07 16:35:00 329

原创 排序算法-桶排序和计数排序

桶排序桶排序(Bucket sort)或所谓的箱排序,也是一种排序算法。 其工作的原理是将数组分到有限数量的桶子里。每个桶子再个别排序(有可能再使用别的排序算法或是以递归方式继续使用桶排序进行排序)。桶排序是鸽巢排序的一种归纳结果。当要被排序的数组内的数值是均匀分配的时候,桶排序使用线性时间(Θ(n))。但桶排序并不是比较排序,他不受到O(n log n)下限的影响。

2016-03-05 13:09:03 436

转载 Objective-C Runtime 一小时入门教程(上)

如果你没有Objective-C基础,请学习了基础的iOS开发再来,这个1小时是给有一定iOS基础的童鞋的。如果你是大牛或者你感觉Objective-C Runtime太简单不用1小时学习的,也请您绕道,这或许只是我的私人笔记了。

2016-03-05 12:45:07 771

原创 排序算法-归并排序

介绍归并排序(英语:Merge sort,或mergesort),是创建在归并操作上的一种有效的排序算法,效率为O(n log n)。该算法是采用分治法(Divide and Conquer)的一个非常典型的应用,且各层分治递归可以同时进行。归并操作归并操作也叫归并算法,指的是将两个已经排序的序列合并成一个序列的操作。归并排序算法依赖归并操作。

2016-03-04 21:22:59 353

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除