- 博客(29)
- 资源 (10)
- 收藏
- 关注
原创 汉诺塔--递归经典
//// main.cpp// 递归2_汉诺塔//// Created by WeiZhen_Liu on 1/26/14.// Copyright (c) 2014 WeiZhen_Liu. All rights reserved.//#include using namespace std;void hanio(int n, char a, char b, cha
2014-01-26 15:37:01 603
原创 some url for learn
打印特殊字符问题: http://stackoverflow.com/questions/14766169/codes-to-display-a-smiley-and-sad-face-in-c-console点击打开链接
2014-01-24 11:16:09 708
原创 宏
#import #define TARGET_MY_TEST_2 6000int main(int argc, const char * argv[]){ @autoreleasepool { #if TARGET_MY_TEST_1 NSLog(@"1"); // no output #if TARGET_MY_TEST_2
2013-08-08 15:09:25 874
原创 iOS文件管理 NSFileManager NSFileHandle
http://liuxing8807.blog.163.com/blog/static/9703530520133413353291/http://www.cnblogs.com/jay-dong/archive/2013/01/21/2870414.html
2013-08-08 09:11:44 1202
原创 NSOperation/NSOperationQueue small demo
// ImageLoadOperation.h#import @interface ImageLoadOperation : NSOperation{ NSURL *_imageURL; id _target; SEL _action;}- (id)initWithImageURL:(NSURL *)imageURL target:(id)target ac
2013-08-06 16:19:08 1133
原创 沙盒目录下创建文件夹
查看沙盒方法:前往 --> (按住option键) 资源库 --> Application Support --> iPhone Simulator --> ...在沙盒目录下创建文夹,可以用 - (BOOL)createDirectoryAtPath:(NSString *)path withIntermediateDirectories:(BOOL)createIntermedi
2013-08-06 16:02:29 1190
原创 removeObjectIdenticalTo
removeObjectIdenticalTo函数会移除数组中所有地址相同的元素//// main.m#import int main(int argc, const char * argv[]){ @autoreleasepool { NSNumber *num_1 = @1; NSNumber *num_2 = @2;
2013-08-06 15:25:42 1356
原创 UITableView代理方法的执行流程
just explain it with code:// ViewController.m#import "ViewController.h"@implementation ViewController- (void)viewDidLoad{ [super viewDidLoad]; _items = [[NSMutableArray alloc] in
2013-08-06 08:38:46 2200
原创 MD5 Hash NSURL
// ViewController.m#import "ViewController.h"#import // use MD5 Hash URL @implementation ViewController- (void)viewDidLoad{ [super viewDidLoad]; NSURL *url = [NSURL URLWithString:@"
2013-08-05 17:10:04 969
原创 NSDate
NSDate 比较:NSDate *date = [NSDate date];NSDate *laterDate = [date dateByAddingTimeInterval:1000];if ([date compare:laterDate] == NSOrderedAscending) { NSLog(@"NSOrderedAscending"); // output}
2013-08-05 09:47:11 924
原创 [[UIScreen mainScreen] applicationFrame]
Just explain it with code:// ViewController.m#import "ViewController.h"#define kMainScreenFrame [[UIScreen mainScreen] bounds]#define kMainScreenWidth kMainScreenFrame.size.width#define kMainSc
2013-08-05 08:22:45 1044
原创 Some hyperlinks
http://www.56.com/u84/v_OTM0ODE0MTc.html/1030_chaojiyoumo.html
2013-08-04 19:38:43 585
原创 dispatch_once
dispatch_once的意思是程序在执行期间只执行一次dispatch_once包含的代码:建一单视图应用程序:‘// TestClass.h#import @interface TestClass : NSObject- (void)test;@end// TestClass.m#import "TestClass.h"@implementation Te
2013-08-03 15:35:48 793
原创 id
//// main.m// Created by WeiZhen_Liu on 13-8-1.//#import int main(int argc, const char * argv[]){ @autoreleasepool { id i = (id)90; printf("%d", (int)i);
2013-08-03 14:05:58 567
原创 self and super
Just explain it with Code:// A.h#import @interface A : NSObject- (void)test;@end// A.m#import "A.h"@implementation A- (void)test{ NSLog(@"A test"); [self go];}- (void)go{
2013-08-03 10:21:38 764
原创 NSNull nil Nil
//// ViewController.m// NULL nil Test Demo//// Created by WeiZhen_Liu on 13-7-29.// // http://nshipster.com/nil////** NSNull is used throughout Foundation and other frameworks to skirt ar
2013-08-03 10:14:13 754
原创 cancelPreviousPerformRequestsWithTarget
from stackoverflow: http://stackoverflow.com/questions/7589644/why-doesnt-cancelpreviousrequestswithtarget-cancel-an-nstimer#import "ViewController.h"@interface ViewController ()@end@implement
2013-07-29 13:58:41 1103
原创 UITextField/UITextView 选中时改变边框颜色
#import "ViewController.h"// first import QuartCore.framework and then add this line#import @interface ViewController () @end@implementation ViewController- (void)viewDidLoad{ [supe
2013-07-24 15:58:55 2611
原创 NSLog中文问题
// main.m// Created by WeiZhen_Liu on 13-7-22.#import int main(int argc, const char * argv[]){ @autoreleasepool { char *pStr_1 = "hello world!"; char *pStr_2 = "hello 世界!";
2013-07-22 14:04:16 754
原创 解决键盘遮挡UITextField问题
//// ViewController.m// UITextFieldScrollDemo//// Created by WeiZhen_Liu on 13-7-19.// Copyright (c) 2013年 WeiZhen_Liu. All rights reserved.//#import "ViewController.h"@interface ViewCon
2013-07-19 23:30:35 666
原创 UILable sizeToFit
UILable的sizeToFit方法很不错,可以直接通过调用它改变label的frame- (void)viewDidLoad{ [super viewDidLoad]; // 对于多行文字的label,必湏指定宽度 // UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 0,
2013-07-18 11:27:44 1541
原创 UIButton setShowsTouchWhenHighlighted
- (void)viewDidLoad{ [super viewDidLoad]; UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; [button setFrame:CGRectMake(20, 20, 280, 30)]; [button setTitle:@"TestS
2013-07-18 11:03:54 1126
原创 画倒三角
- (void)viewDidLoad{ [super viewDidLoad]; CustomView *customView = [[CustomView alloc] initWithFrame:CGRectMake(20, 20, 280, 200)]; UILabel *label = [[UILabel alloc] initWithFrame:CGRectM
2013-07-18 08:55:02 1071
原创 私有属性
如果类的属性不直接通过点语法赋值可以写成私有的- (IBAction)testPropertyButtonClick:(id)sender { TestObject *testObj = [[TestObject alloc] init]; testObj.name = @"name"; NSLog(@"testObj.name: %@", testObj.name);
2013-07-17 10:49:52 550
原创 UILabel 显示null
- (void)viewDidLoad{ [super viewDidLoad]; UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(20, 20, 280, 40)]; // label.text = [NSString stringWithFormat:@"%@, %@", @"Hi", nil];
2013-07-16 09:09:42 1597
原创 UITabBarItem文字的设置
设置位置:[tab.tabBarItem setTitlePositionAdjustment:UIOffsetMake(0, -10)]设置高亮时文字颜色:NSDictionary *highlightedAttributes = [NSDictionary dictionaryWithObject:[UIColor orangeColor] forKey:UITextAttribu
2013-07-15 17:23:45 2705
原创 NSNotification+extern
// Child.hNSString *notificationName;#import @interface Child : NSObject{ NSInteger _sleepTime;}@property (nonatomic) NSInteger sleepTime;@end// Child.m#import "Child.h"@implemen
2013-07-12 15:03:18 555
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人