12 2015 档案

摘要:/** * static 和 extern 修饰局部和全局变量 // static 可以修饰局部变量 // 作用:1)static定义的变量的作用域会得到延长 // 2)static定义的变量的语句只会被执行一次 extern是不能够修饰局部变量的 ... 阅读全文
posted @ 2015-12-28 09:36 Z了个L 阅读(176) 评论(0) 推荐(0)
摘要:#include int sum(int a, int b){ return a + b;}int jian(int a, int b){ return a - b;}int main(int argc, const char * argv[]) { // 1.基本数据类型... 阅读全文
posted @ 2015-12-26 18:20 Z了个L 阅读(157) 评论(0) 推荐(0)
摘要:#include int main(int argc, const char * argv[]) { // 定义变量 char str[100]; int words = 0; int count = 0; // 提示用户输入字符串 printf(... 阅读全文
posted @ 2015-12-26 08:04 Z了个L 阅读(253) 评论(0) 推荐(0)
摘要:#include int insertItemLoc(int arr[], int len, int key){ // 定义变量 int low = 0, high = len - 1, mid; // 循环 while (low arr[mid]) { ... 阅读全文
posted @ 2015-12-25 09:19 Z了个L 阅读(351) 评论(0) 推荐(0)
摘要:#include /** * 使用折半查找,来查找一个数 * * @param arr 数组 * @param len 数组的长度 * @param key 要查找的数 * * @return 要查找的数的位置,如果查找不到返回 -1 */int searchItem(int arr[],... 阅读全文
posted @ 2015-12-25 09:16 Z了个L 阅读(765) 评论(0) 推荐(0)
摘要:#include // 选择排序void selectSort(int arr[], int len){ int temp; for (int i = 0; i arr[j]) { temp = arr[i]; arr[i] ... 阅读全文
posted @ 2015-12-24 15:50 Z了个L 阅读(140) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2015-12-24 10:31 Z了个L 阅读(158) 评论(0) 推荐(0)
摘要:#include void maoPao(int arr[], int len){ int temp; for (int i = 0; i arr[j + 1]) { temp = arr[j]; arr[j] = arr[j... 阅读全文
posted @ 2015-12-24 10:09 Z了个L 阅读(113) 评论(0) 推荐(0)
摘要:或者在这个对应的Source Code中添加NSAppTransportSecurityNSExceptionDomainsbaidu.comNSExceptionAllowInsecureHTTPLoadsNSIncludesSubdomainsNSExceptionRequiresForward... 阅读全文
posted @ 2015-12-23 17:51 Z了个L 阅读(155) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2015-12-23 12:58 Z了个L 阅读(231) 评论(0) 推荐(0)
摘要:#include int main(int argc, const char * argv[]) { int a = 3, b = 4; printf("a = %d, b = %d\n", a, b); /* 1.加减法 a = b - a; b = ... 阅读全文
posted @ 2015-12-23 10:33 Z了个L 阅读(311) 评论(0) 推荐(0)
摘要:#include void changeTo(int n){ // 计算数的位数 int len = sizeof(n) * 8; int temp; int t; for (int i = 0; i > (len-1-i); t = temp & 1; ... 阅读全文
posted @ 2015-12-23 10:15 Z了个L 阅读(534) 评论(0) 推荐(0)
摘要:int m = 10 , n= 3;m % n m除以n之后,取得余数之后10 % 3 == 1m = 0 可以的,0n = 0 不可以,无意义m > n 正常求余即可m < n 结果为m求余的注意事项1)m和n都不能为小数2)m < 0 结果为负数3)n < 0 正负性取决于m 阅读全文
posted @ 2015-12-21 10:20 Z了个L 阅读(565) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2015-12-21 09:14 Z了个L 阅读(428) 评论(0) 推荐(0)
摘要:1)%md问题(设置域宽问题)m - 数字,这个数字可以为正,也可以为负 如果要输出的数的位数 > 域宽m 按照数据的实际位数输出 printf("%3d\n", 1000); 如果要输出的数的位数 0 从左侧开始补空格 m < 0 2)%0md使用注意 %0md表示 ... 阅读全文
posted @ 2015-12-20 19:55 Z了个L 阅读(438) 评论(0) 推荐(0)
摘要:// ViewController.h#import @interface ViewController : UITableViewController@end// ViewController.m#import "ViewController.h"const CGFloat HMTopView... 阅读全文
posted @ 2015-12-18 23:35 Z了个L 阅读(222) 评论(0) 推荐(0)
摘要:错误原因:1)可能是因为#import了.m文件2)可能是因为项目中存在了2个一样的.m文件 阅读全文
posted @ 2015-12-06 16:05 Z了个L 阅读(352) 评论(0) 推荐(0)
摘要:// 设置左边的返回按钮viewController.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(back) image:@"navigationbar_back" ... 阅读全文
posted @ 2015-12-06 15:27 Z了个L 阅读(188) 评论(0) 推荐(0)
摘要:1.让所有push进来的控制器,它是导航栏左上角和右上角的内容都一样2.拦截所有push进来的控制器3.思路:自定义导航控制器,重写push方法,就可以得到传进来的控制器参数// HWNavigationController.h#import @interface HWNavigationCont... 阅读全文
posted @ 2015-12-06 15:21 Z了个L 阅读(243) 评论(0) 推荐(0)
摘要:// 为UIView写分类//UIView+Extension.h#import @interface UIView (Extension)@property (nonatomic, assign) CGFloat x;@property (nonatomic, assign) CGFloat y;... 阅读全文
posted @ 2015-12-06 12:40 Z了个L 阅读(378) 评论(0) 推荐(0)
摘要:// block用来保存一段代码 // block的标志:^ /* block跟函数很像 1.可以保存代码 2.有返回值 3.有形参 4.调用方式一样 */ // 定义block变量 void (^myblock)... 阅读全文
posted @ 2015-12-04 18:23 Z了个L 阅读(138) 评论(0) 推荐(0)
摘要:// age1\age2是常量,只读,下面两个写法是相同的 const int age1 = 20; int const age2 = 30; // const的修饰的*p1和*p2,*p1和*p2是常量,不能通过p1、p2指针间接修改其他变量的值,下面p1和p2的写法相同 ... 阅读全文
posted @ 2015-12-03 19:18 Z了个L 阅读(184) 评论(0) 推荐(0)
摘要:每个对象都有- (BOOL)isEqual:(id)object这个方法例如:/** * 常用来比较两个HWEmotion对象(地址)是否一样 * * @param other 另外一个HWEmotion对象 * * @return YES : 代表2个对象是一样的,NO: 代表2个对象是不一... 阅读全文
posted @ 2015-12-02 20:30 Z了个L 阅读(490) 评论(0) 推荐(0)
摘要://首先必须遵守这个协议,然后实现下面2个方法/** * 当一个对象要归档进沙盒中时,就会调用这个方法 * 目的:在这个方法中说明这个对象的哪些属性要存进沙盒 */- (void)encodeWithCoder:(NSCoder *)encoder{ [encoder encodeObje... 阅读全文
posted @ 2015-12-02 10:00 Z了个L 阅读(154) 评论(0) 推荐(0)
摘要:let String --- NSStringvar String --- NSMutableString数组var array = ["A","B","C"]-一个数组只能存储特定类型的数据-所存储的数据不一定是一个类的对象,可以是基础数据类型字典var dictionary = [1:"A", ... 阅读全文
posted @ 2015-12-01 22:19 Z了个L 阅读(147) 评论(0) 推荐(0)
摘要:let---constants---常量var---variables---变量基本运算符:Int---整型Double,Flost---浮点型String---字符串型if后面的判断要么是bool值,要么是表达式Tuples元组---将多个不同的值集合成一个数据特点:1)可以有任意多个值;2)不同... 阅读全文
posted @ 2015-12-01 13:56 Z了个L 阅读(121) 评论(0) 推荐(0)
摘要:selectedRange :1.本来是用来控制textView的文字选中范围2.如果selectedRange.length为0,selectedRange.location就是textView的光标位置关于textView文字的字体1.如果是普通文字(text),文字大小由textView.fo... 阅读全文
posted @ 2015-12-01 11:56 Z了个L 阅读(128) 评论(0) 推荐(0)