changjiashuai's blog

Runnig...

The future belongs to those who believe in the beauty of their dreams.


宏定义

对象宏

#define M_PI 3.1415926535
double r = 1.0;
double circlePerimeter = 2 * M_PI * r;
// => double circlePerimeter = 2 * 3.1415926535 * r ## 函数宏
#define FUNC(x) x
NSLog(@"Hello %@", FUNC("world");
// => NSLog(@"Hello %@", "world");
最近的文章

Eclipse工程导入到Android Studio

1、首先升级ADT到最新版本 2、选择需要从Eclipse导出的工程,右键选择Export并选择Android下的Generate Gradle Build Files 如图所示: 3、选择完毕后并不会导出到其他地方,而是在本地工程生成一个build.gradle文件,在Eclipse工程中也可以看到,这个文件是Android Studio识别的,如图所示: 4、随后进入Android Studio并选择Import Project,可以看到刚刚在Ecli...…

继续阅读
更早的文章

Swift---泛型(Generics)

泛型使您能够编写灵活的、可重用的功能和类型的代码。 例如要交换两个变量值的问题不用泛型//Int类型交换func swapTwoInts(inout a: Int, inout b: Int){ let temp = a a = b b = temp}var someInt = 3var anotherInt = 107swapTwoInts(&someInt, &anotherInt)println("someInt is now \(someInt), and ...…

继续阅读