说明:本人用的win8 系统装Code::Blocks练习OC。1.类的声明和实现的关系图:@interface就好像暴露在外面的时钟表面@implementation就好像隐藏在时钟内部的构造实现2.语法中要注意的地方(1).成员变量不能在{}中进行初始化、不能被直接拿出去訪问(2).方法不能当做...
分类:
其他好文 时间:
2015-03-20 20:09:48
阅读次数:
219
Blocks 是C语言的扩充功能,带有自动变量的匿名函数。C 函数指针类型变量 vsBlock 类型变量C 函数指针类型变量Block 类型变量返回值类型 方法名 参数列表 表达式int func(int count){ return count + 1;}^返回值类型参数列表 表达式^int (....
分类:
其他好文 时间:
2015-03-20 18:00:36
阅读次数:
139
Use two vector to record left and right indexes that can extend the blocks. 1 class Solution { 2 public: 3 int largestRectangleArea(vector &height...
分类:
其他好文 时间:
2015-03-20 08:02:31
阅读次数:
126
Getting
Started with Blocks(开始block)
The
following sections help you to get started with blocks using practical examples.
接下来这一节有实用的例子帮你开始blocks.
Declaring and Using a Block (定义和使用block)...
分类:
移动开发 时间:
2015-03-16 14:40:40
阅读次数:
279
功能描述:
分解 assets 目录文件下的 PNG 图片成 各个小尺寸 PNG 图片 。
主函数执行:
// 创建目录, 用来保存分解出来的图片 createPath("/sdcard/gui_blocks/"); createPath("/sdcard/gui_blocks_2/"); createPath("/sd...
分类:
移动开发 时间:
2015-03-15 23:42:19
阅读次数:
522
内存机制0、iOS内存管理策略和实践1、Swift中的ARCBlock0、教你爱上Blocks(闭包)1、Objective-C中的Block(王巍)2、Objective-C中的Block(付宇轩)多线程0、深入理解 GCD(一)网络0、NSURLCache1、IP,TCP 和 HTTP运行时0、...
分类:
移动开发 时间:
2015-03-08 22:43:41
阅读次数:
184
??
Modeling New Properties
新特性建模
The basic properties of the UML’s
building blocks-----attributes and operations for classes, the contents of packages, and so on----are generic enough to...
分类:
其他好文 时间:
2015-03-06 09:40:22
阅读次数:
133
2.3.5 __block变量存储域
Block变量从栈复制到堆时对__block变量产生的影响
__block变量存储域
影响
栈
从栈复制到堆并被Block持有
堆
被Block持有
在多个Block中使用__block变量时,第一个Block从栈复制到堆时,__block变量也一并...
分类:
移动开发 时间:
2015-03-04 11:11:10
阅读次数:
131
2.3.2 截获自动变量
通过转换后的源码可以发现,Block语法中使用的自动变量被作为成员变量追加到__main_block_impl_0结构体中,Block中没有使用的自动变量不会被追加,所以Block的变量截获只针对Block使用的自动变量。
源码:
#include
//不导入库文件无法运行
int
main() {
int val1=0;
int...
分类:
移动开发 时间:
2015-03-04 11:09:40
阅读次数:
159
2.3 Blocks的实现
2.3.1 Block的实质
通过命令”clang -rewrite-objc 文件名”能够将含有Block语法的源代码转换为C++源代码。
含有Block的源代码如下:
#include
//不导入库文件无法运行
int
main() {
void(^testBlock)(void)=^{
printf...
分类:
移动开发 时间:
2015-03-04 09:47:38
阅读次数:
197