1.加边框 2
2.清空View 2
3.添加navigationBar 2
4.保存内存地址 2
5.地图改变位置 2
6.进制转化 3
7.时间格式转换 3
8.类 4
9.内存 4
10.地图 4
1. [self.view insertSubview:mapView atIndex:0]; 4
11.动画 4
12.view 里的视图 5
13.读取本地文件 内容 5
14.提取字符串 5
15.xml序列化和反序列化 6
16.mac翻..阿..城墙 6
17.NSString 初始化 6
18.属性定义 6
19.每隔一段时间 执行 事件 6
20.页面推送方式 7
2.命令打开 svn 7
3.就可以了 8
4.UITableView 8
5.只有在此时cai释放内存 9
6.键盘样式 9
7.两个字符串忽略大小写相等 9
8.键盘 return 9
9.指针 9
10.int Nsnumber 9
11.好的电子书 9
12.简单的网络读出数据 10
13.简体中文编码 11
14.《斯坦福:iphone开发教程》[中英双语字幕] 11
15. 11
16.GDataXMLDocument 转成string类型 11
17.循环依赖 11
18.CocoaData 12
19.数据库操作 12
20.改变scroolview的位置 13
21.设置Button字体设置 13
22.UITextField 14
23.tableview下拉不上升 14
[list=1]加边框
myWebView.layer.borderWidth= 5;
myWebView.layer.borderColor= [[UIColor colorWithRed:0.52 green:0.09 blue:0.07 alpha:1] CGColor];
[list=1]清空View
for(UIView *subView in [controller.view subViews]){
[subViewremoveFromSuperview];
}
[list=1]添加navigationBar
[self.navigationController.view addSubview:self.navigationController.navigationBar];
[list=1]保存内存地址
[arrFriend retain];
[list=1]地图改变位置
-(void)gotoLocation:(CLLocationCoordinate2D)clloc
{
MKCoordinateRegionnewRegion;
newRegion.center= clloc;
newRegion.span.latitudeDelta= 0.01;
newRegion.span.longitudeDelta= 0.01;
[_googleView.map setRegion:newRegionanimated:YES];
}
[list=1]进制转化
-(CFStringRef)EncodeUTF8Str:(NSString*)encodeStr{
CFStringRefnonAlphaNumValidChars = CFSTR("![ DISCUZ_CODE_1 ]’()*+,-./:;=?@_~");
CFStringRefpreprocessedString =CFURLCreateStringByReplacingPercentEscapesUsingEncoding(kCFAllocatorDefault,(CFStringRef)encodeStr,CFSTR(""),kCFStringEncodingUTF8);
CFStringRefnewStr =CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,preprocessedString,NULL,nonAlphaNumValidChars,kCFStringEncodingUTF8);
returnnewStr;
}
//转换成GB2312
-(NSString*)EncodeGB2312Str:(NSString*)encodeStr{
CFStringRefnonAlphaNumValidChars = CFSTR("![ DISCUZ_CODE_1 ]’()*+,-./:;=?@_~");
NSString*preprocessedString = (NSString*)CFURLCreateStringByReplacingPercentEscapesUsingEncoding(kCFAllocatorDefault,(CFStringRef)encodeStr,CFSTR(""),kCFStringEncodingGB_18030_2000);
NSString*newStr = [(NSString*)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,(CFStringRef)preprocessedString,NULL,nonAlphaNumValidChars,kCFStringEncodingGB_18030_2000)autorelease];
[preprocessedStringrelease];
returnnewStr;
}
[list=1]时间格式转换
UILabel*date=[[UILabel alloc]initWithFrame:CGRectMake(200,5,100,20)];
NSDateFormatter*inform = [[NSDateFormatter alloc]init];
[informsetDateFormat:@"yyyy-MM-ddHH:mm:ss"];
NSDate*parsed = [inform dateFromString:[muDictTheme objectForKey:@"dateline"]];
NSDateFormatter*toform = [[NSDateFormatter alloc]init];
[toformsetDateFormat:@"MM月dd,HH:mm"];
date.text= [toform stringFromDate:parsed];
[list=1]类
[[Fractionclass] t];
或者
Classclazz=[Fraction class];
[clazzt];
[list=1]内存
NSLog(@"arrFriendcount=%d",[arrFriend retainCount]);
[list=1]地图
[list=1][list=1]控制地图的中心和显示大小
MKCoordinateRegionnewRegion;
newRegion.center= clloc;
newRegion.span.latitudeDelta=0.9;//0.01
newRegion.span.longitudeDelta= 0.9;
[_googleView.map setRegion:newRegionanimated:YES];
1.[self.view insertSubview:mapView atIndex:0];
[list=1]动画
[UIView beginAnimations:@"hideView" context:nil];//开始动画 动画名称
[UIView setAnimationDuration:0.2];//动画速度
[UIView setAnimationCurve:UIViewAnimationCurveLinear];//动画方向
[testV setFrame:CGRectMake(10,40,40,0)];
[UIView commitAnimations];//结束动画
[list=1]view 里的视图
for(UIView*v in[self.view subviews]){
if([v isKindOfClass:[UIButton class]]==NO){
[vremoveFromSuperview];
}
}
[list=1]读取本地文件 内容
NSString*filePath=[[NSBundle mainBundle]pathForResource:@"1" ofType:@"txt"];
NSString*str=[[NSString alloc]initWithContentsOfFile:filePath];
NSLog(@"%@",str);
[list=1]提取字符串
// 得到引用的用户名 和发表时间
-(NSString*)WebQuoteUserTime:(NSString*)strText
{
NSString*strResult=[[[NSString alloc]init]autorelease];
NSString*strMiddle=strText;
NSRangerangQuote1=[strMiddle rangeOfString:@"[quote]"];
NSRangerangQuote=[strMiddle rangeOfString:@""];
NSRangerangSize=[strMiddle rangeOfString:@""];
if(rangQuote1.length>0&&rangQuote.length>0&&rangSize.length>0){
strResult=[strMiddlesubstringWithRange:NSMakeRange(rangQuote.location+rangQuote.length,rangSize.location-rangQuote.location-rangQuote.length)];
}
returnstrResult;
}
[list=1]xml序列化和反序列化
xml转换成对象称为反序列化
对象 转换成xml称为序列化
[list=1]mac翻..阿..城墙
vbn系统自带的
[list=1]NSString 初始化
Nsstring *str=nil;//如果不初始化 访问的地址会有错 不确定
[list=1]属性定义
@property(nonatomic,assign)NSIntegernodeCount;
@property(nonatomic,assign)NSInteger unreadMsgSum;
@property(nonatomic,retain)CatalogIDListClass*catalogIDList;
@property(nonatomic,retain)MessageInfoListClass*messageInfoList;
@property(nonatomic,copy)NSString*parentcatalogID;
@property(nonatomic,copy)NSString*Etag_Catalog;
属性 也要再定义
也要释放 如果用retain当变量改变是 也可以在改变
[list=1]每隔一段时间 执行 事件
[NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(makeMyProgressBarMoving)userInfo:nil repeats:NO];
[list=1]页面推送方式
[self presentModalViewController:pickeranimated:YES];
2.命令打开svn
cddesktop/megafon
svnst .
svnupdate
Lastlogin: Fri Apr 29 10:02:58 on ttys001
Sunnys-iMac:~Sunny$ pwd
/Users/Sunny
Sunnys-iMac:~Sunny$ cd desktop
Sunnys-iMac:desktopSunny$ ls
02-代码 Megafoniphone低保真设计.ppt
1.jpg OOo_3.2.0_MacOSXIntel_install_en-US.dmg
2.jpg QQ
MegaFon head.jpg
Sunnys-iMac:desktopSunny$ cd 02-代码
Sunnys-iMac:02-代码 Sunny$ls
MegaFon.xcodeproj ThirdParty build
Src UnitTest
Sunnys-iMac:02-代码 Sunny$svn st
? build
? Src/ViewControllers/Product.h
? Src/ViewControllers/Product.m
? Src/ViewControllers/head.jpg
M Src/ViewControllers/LoginViewController.m
M Src/ViewControllers/ContactsViewController.h
M Src/ViewControllers/ContactsViewController.m
? MegaFon.xcodeproj/Sunny.mode1v3
M MegaFon.xcodeproj/project.pbxproj
Sunnys-iMac:02-代码 Sunny$svn up
Atrevision 53.
Sunnys-iMac:02-代码 Sunny$
Sunnys-iMac:02-代码 Sunny$svn update
Atrevision 53.
Sunnys-iMac:02-代码 Sunny$
3.就可以了
4.UITableView
-(NSArray*)sectionIndexTitlesForTableView:(UITableView*)tableView
{
NSArray*arr1=[[NSArray alloc]initWithObjects:@"A",@"B",@"C",@"D",@"E",@"F",@"G",@"H",@"I",@"J",@"K",@"L",@"M",@"N",@"O",@"P",@"Q",@"R",@"S",@"T",@"U",@"V",@"W",@"X",@"Y",@"Z",@"#",nil];
NSMutableArray*keyArray = [[NSMutableArray alloc]init];
[keyArrayaddObject:UITableViewIndexSearch];
//[keyArrayaddObjectsFromArray:arr1
// sortedArrayUsingSelector:@selector(compare:)]];
[keyArrayaddObjectsFromArray:arr1];
returnkeyArray;
returnarr1;
}
[list=1][list=1]动画
[UIViewbeginAnimations:nilcontext:NULL];
[UIViewsetAnimationDuration:10];
//theView.center= thePostiton;
scroll.frame= CGRectMake(0,-200,self.view.bounds.size.width,self.view.bounds.size.height);
[UIViewcommitAnimations];
5.只有在此时cai释放内存
alloc
retain
copy
6.键盘样式
field.keyboardType= UIKeyboardTypeNumberPad;
7.两个字符串忽略大小写相等
[self.strFatherVC caseInsensitiveCompare:@"Prifile"]==NSOrderedSame
8.键盘 return
fieldLastName.returnKeyType= UIReturnKeyDone;
9.指针
单指针指向 值
双指针 指向 指针
10.int Nsnumber
[dictionarysetObject:[NSNumber numberWithInt:1]forKey:@"messageStatus*****ForBack"];
11.好的电子书
iPhone开发入门经典
美(johnray 著seanJohnson 袁国忠译)
人民邮电出版社
12.简单的网络读出数据
NSString*userName1=[self EncodeGB2312Str:username];
NSString*strUrl = [NSString stringWithFormat:@"%@allFriend.asp?username=%@",ServerAddress,userName1];
NSMutableURLRequest*request = [[NSMutableURLRequest alloc]initWithURL:[NSURL URLWithString:strUrl]];
//[requestsetHTTPMethod:@"POST"];
NSData*returnData = [[NSData alloc]initWithData:[NSURLConnection sendSynchronousRequest:requestreturningResponse:nil error:nil]];
[requestrelease];
NSStringEncodingenc = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000);
NSString*returnString=[[NSString alloc]initWithData:returnDataencoding:enc];
[returnDatarelease];
if([returnString length]>42){
returnString=[returnStringsubstringFromIndex:42];
}
else{
NSLog(@"returnString数据不对");
}
NSError*error;
NSDictionary*dict= [XMLReader dictionaryForXMLString:returnStringerror:&error];
returndict ;
13.简体中文编码
NSStringEncodingenc = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000);
NSString*returnString=[[NSString alloc]initWithData:buf encoding:enc];
14.《斯坦福:iphone开发教程》[中英双语字幕]
15.
http://v.163.com/special/opencourse/iphonekaifa.html
《斯坦福:iphone开发教程》[中英双语字幕]
更新至第10集
16.GDataXMLDocument转成string类型
doc =[[GDataXMLDocument alloc] initWithRootElement:element];
{
NSString *xmlStr= [[NSString alloc] initWithData:[doc XMLData]encoding:NSUTF8StringEncoding];
NSLog(@"%@",xmlStr);
[xmlStr release];
}
[doc release];
doc = nil;
17.循环依赖
@class SmsProcessor;
18.CocoaData
NDGroup*group = [NDGroupAccessor groupWithID:groupID];
NSSet*set = [group unityMessages];
NSMutableArray*array = nil;
for(UnityMessage*msg inset) {
if(msg.msgType== SMS){
[arrayaddObject:msg];
}
}
19.数据库操作
/**
Methodto get smses from group
@paramgroupID a unique identification of group
@returnsa Sms of NSArray
*/
-(NSArray*)smsesFromGroupID:(NSString*)groupID
{
if(groupID == nil){
return nil;
}
[self resetLastError];
NSError*error = nil;
MegaFonModel*megaFonModel = [MegaFonModel sharedModel];
NSFetchRequest*fetchRequest =[[NSFetchRequest alloc]init];
NSEntityDescription*entity=[NSEntityDescription
entityForName:@"SMS"
inManagedObjectContext:megaFonModel.managedObjectContext];
[fetchRequestsetEntity:entity];
//设置条件
NSPredicate*predicate = [NSPredicate predicateWithFormat:@"(groupID= %@)",groupID];
[fetchRequestsetPredicate:predicate];
NSArray*array = [megaFonModel.managedObjectContext executeFetchRequest:fetchRequesterror:&error];
[fetchRequestrelease];
if(error) {
_lastError= [error retain];
array= nil;
}
if(!error&&[arraycount]>=1){
returnarray;
}
return nil;
}
20.改变scroolview的位置
[self.tableView setContentOffset:CGPointMake(0,50.f)animated:NO];
21.设置Button字体设置
UIButton*btn=[[UIButton alloc]initWithFrame:CGRectMake(0,0,60,50)];
[btnsetTitle:@"124" forState:UIControlStateNormal];
btn.titleLabel.font=[UIFont systemFontOfSize:19];
[self.view addSubview:btn];
22.UITextField
UITextField*fieldPwd=[[UITextField alloc]initWithFrame:CGRectMake(65,40,200,25)];
fieldPwd.borderStyle=UITextBorderStyleRoundedRect;
fieldPwd.keyboardType=UIKeyboardTypeASCIICapable;
fieldPwd.secureTextEntry= YES;
fieldPwd.text=@"sara@gmail.com";
[cell.contentView addSubview:fieldPwd];
[fieldPwdrelease];
fieldPwd=nil;
23.tableview下拉不上升
-(void)viewWillAppear:(BOOL)animated{
[superviewWillAppear:animated];
[table_viewsetContentOffset:CGPointMake(0, 44) animated:NO];
NSIndexPath*tableSelection = [table_view indexPathForSelectedRow];
[table_viewdeselectRowAtIndexPath:tableSelection animated:NO];
}
2.清空View 2
3.添加navigationBar 2
4.保存内存地址 2
5.地图改变位置 2
6.进制转化 3
7.时间格式转换 3
8.类 4
9.内存 4
10.地图 4
1. [self.view insertSubview:mapView atIndex:0]; 4
11.动画 4
12.view 里的视图 5
13.读取本地文件 内容 5
14.提取字符串 5
15.xml序列化和反序列化 6
16.mac翻..阿..城墙 6
17.NSString 初始化 6
18.属性定义 6
19.每隔一段时间 执行 事件 6
20.页面推送方式 7
2.命令打开 svn 7
3.就可以了 8
4.UITableView 8
5.只有在此时cai释放内存 9
6.键盘样式 9
7.两个字符串忽略大小写相等 9
8.键盘 return 9
9.指针 9
10.int Nsnumber 9
11.好的电子书 9
12.简单的网络读出数据 10
13.简体中文编码 11
14.《斯坦福:iphone开发教程》[中英双语字幕] 11
15. 11
16.GDataXMLDocument 转成string类型 11
17.循环依赖 11
18.CocoaData 12
19.数据库操作 12
20.改变scroolview的位置 13
21.设置Button字体设置 13
22.UITextField 14
23.tableview下拉不上升 14
[list=1]加边框
myWebView.layer.borderWidth= 5;
myWebView.layer.borderColor= [[UIColor colorWithRed:0.52 green:0.09 blue:0.07 alpha:1] CGColor];
[list=1]清空View
for(UIView *subView in [controller.view subViews]){
[subViewremoveFromSuperview];
}
[list=1]添加navigationBar
[self.navigationController.view addSubview:self.navigationController.navigationBar];
[list=1]保存内存地址
[arrFriend retain];
[list=1]地图改变位置
-(void)gotoLocation:(CLLocationCoordinate2D)clloc
{
MKCoordinateRegionnewRegion;
newRegion.center= clloc;
newRegion.span.latitudeDelta= 0.01;
newRegion.span.longitudeDelta= 0.01;
[_googleView.map setRegion:newRegionanimated:YES];
}
[list=1]进制转化
-(CFStringRef)EncodeUTF8Str:(NSString*)encodeStr{
CFStringRefnonAlphaNumValidChars = CFSTR("![ DISCUZ_CODE_1 ]’()*+,-./:;=?@_~");
CFStringRefpreprocessedString =CFURLCreateStringByReplacingPercentEscapesUsingEncoding(kCFAllocatorDefault,(CFStringRef)encodeStr,CFSTR(""),kCFStringEncodingUTF8);
CFStringRefnewStr =CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,preprocessedString,NULL,nonAlphaNumValidChars,kCFStringEncodingUTF8);
returnnewStr;
}
//转换成GB2312
-(NSString*)EncodeGB2312Str:(NSString*)encodeStr{
CFStringRefnonAlphaNumValidChars = CFSTR("![ DISCUZ_CODE_1 ]’()*+,-./:;=?@_~");
NSString*preprocessedString = (NSString*)CFURLCreateStringByReplacingPercentEscapesUsingEncoding(kCFAllocatorDefault,(CFStringRef)encodeStr,CFSTR(""),kCFStringEncodingGB_18030_2000);
NSString*newStr = [(NSString*)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,(CFStringRef)preprocessedString,NULL,nonAlphaNumValidChars,kCFStringEncodingGB_18030_2000)autorelease];
[preprocessedStringrelease];
returnnewStr;
}
[list=1]时间格式转换
UILabel*date=[[UILabel alloc]initWithFrame:CGRectMake(200,5,100,20)];
NSDateFormatter*inform = [[NSDateFormatter alloc]init];
[informsetDateFormat:@"yyyy-MM-ddHH:mm:ss"];
NSDate*parsed = [inform dateFromString:[muDictTheme objectForKey:@"dateline"]];
NSDateFormatter*toform = [[NSDateFormatter alloc]init];
[toformsetDateFormat:@"MM月dd,HH:mm"];
date.text= [toform stringFromDate:parsed];
[list=1]类
[[Fractionclass] t];
或者
Classclazz=[Fraction class];
[clazzt];
[list=1]内存
NSLog(@"arrFriendcount=%d",[arrFriend retainCount]);
[list=1]地图
[list=1][list=1]控制地图的中心和显示大小
MKCoordinateRegionnewRegion;
newRegion.center= clloc;
newRegion.span.latitudeDelta=0.9;//0.01
newRegion.span.longitudeDelta= 0.9;
[_googleView.map setRegion:newRegionanimated:YES];
1.[self.view insertSubview:mapView atIndex:0];
[list=1]动画
[UIView beginAnimations:@"hideView" context:nil];//开始动画 动画名称
[UIView setAnimationDuration:0.2];//动画速度
[UIView setAnimationCurve:UIViewAnimationCurveLinear];//动画方向
[testV setFrame:CGRectMake(10,40,40,0)];
[UIView commitAnimations];//结束动画
[list=1]view 里的视图
for(UIView*v in[self.view subviews]){
if([v isKindOfClass:[UIButton class]]==NO){
[vremoveFromSuperview];
}
}
[list=1]读取本地文件 内容
NSString*filePath=[[NSBundle mainBundle]pathForResource:@"1" ofType:@"txt"];
NSString*str=[[NSString alloc]initWithContentsOfFile:filePath];
NSLog(@"%@",str);
[list=1]提取字符串
// 得到引用的用户名 和发表时间
-(NSString*)WebQuoteUserTime:(NSString*)strText
{
NSString*strResult=[[[NSString alloc]init]autorelease];
NSString*strMiddle=strText;
NSRangerangQuote1=[strMiddle rangeOfString:@"[quote]"];
NSRangerangQuote=[strMiddle rangeOfString:@""];
NSRangerangSize=[strMiddle rangeOfString:@""];
if(rangQuote1.length>0&&rangQuote.length>0&&rangSize.length>0){
strResult=[strMiddlesubstringWithRange:NSMakeRange(rangQuote.location+rangQuote.length,rangSize.location-rangQuote.location-rangQuote.length)];
}
returnstrResult;
}
[list=1]xml序列化和反序列化
xml转换成对象称为反序列化
对象 转换成xml称为序列化
[list=1]mac翻..阿..城墙
vbn系统自带的
[list=1]NSString 初始化
Nsstring *str=nil;//如果不初始化 访问的地址会有错 不确定
[list=1]属性定义
@property(nonatomic,assign)NSIntegernodeCount;
@property(nonatomic,assign)NSInteger unreadMsgSum;
@property(nonatomic,retain)CatalogIDListClass*catalogIDList;
@property(nonatomic,retain)MessageInfoListClass*messageInfoList;
@property(nonatomic,copy)NSString*parentcatalogID;
@property(nonatomic,copy)NSString*Etag_Catalog;
属性 也要再定义
也要释放 如果用retain当变量改变是 也可以在改变
[list=1]每隔一段时间 执行 事件
[NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(makeMyProgressBarMoving)userInfo:nil repeats:NO];
[list=1]页面推送方式
[self presentModalViewController:pickeranimated:YES];
2.命令打开svn
cddesktop/megafon
svnst .
svnupdate
Lastlogin: Fri Apr 29 10:02:58 on ttys001
Sunnys-iMac:~Sunny$ pwd
/Users/Sunny
Sunnys-iMac:~Sunny$ cd desktop
Sunnys-iMac:desktopSunny$ ls
02-代码 Megafoniphone低保真设计.ppt
1.jpg OOo_3.2.0_MacOSXIntel_install_en-US.dmg
2.jpg QQ
MegaFon head.jpg
Sunnys-iMac:desktopSunny$ cd 02-代码
Sunnys-iMac:02-代码 Sunny$ls
MegaFon.xcodeproj ThirdParty build
Src UnitTest
Sunnys-iMac:02-代码 Sunny$svn st
? build
? Src/ViewControllers/Product.h
? Src/ViewControllers/Product.m
? Src/ViewControllers/head.jpg
M Src/ViewControllers/LoginViewController.m
M Src/ViewControllers/ContactsViewController.h
M Src/ViewControllers/ContactsViewController.m
? MegaFon.xcodeproj/Sunny.mode1v3
M MegaFon.xcodeproj/project.pbxproj
Sunnys-iMac:02-代码 Sunny$svn up
Atrevision 53.
Sunnys-iMac:02-代码 Sunny$
Sunnys-iMac:02-代码 Sunny$svn update
Atrevision 53.
Sunnys-iMac:02-代码 Sunny$
3.就可以了
4.UITableView
-(NSArray*)sectionIndexTitlesForTableView:(UITableView*)tableView
{
NSArray*arr1=[[NSArray alloc]initWithObjects:@"A",@"B",@"C",@"D",@"E",@"F",@"G",@"H",@"I",@"J",@"K",@"L",@"M",@"N",@"O",@"P",@"Q",@"R",@"S",@"T",@"U",@"V",@"W",@"X",@"Y",@"Z",@"#",nil];
NSMutableArray*keyArray = [[NSMutableArray alloc]init];
[keyArrayaddObject:UITableViewIndexSearch];
//[keyArrayaddObjectsFromArray:arr1
// sortedArrayUsingSelector:@selector(compare:)]];
[keyArrayaddObjectsFromArray:arr1];
returnkeyArray;
returnarr1;
}
[list=1][list=1]动画
[UIViewbeginAnimations:nilcontext:NULL];
[UIViewsetAnimationDuration:10];
//theView.center= thePostiton;
scroll.frame= CGRectMake(0,-200,self.view.bounds.size.width,self.view.bounds.size.height);
[UIViewcommitAnimations];
5.只有在此时cai释放内存
alloc
retain
copy
6.键盘样式
field.keyboardType= UIKeyboardTypeNumberPad;
7.两个字符串忽略大小写相等
[self.strFatherVC caseInsensitiveCompare:@"Prifile"]==NSOrderedSame
8.键盘 return
fieldLastName.returnKeyType= UIReturnKeyDone;
9.指针
单指针指向 值
双指针 指向 指针
10.int Nsnumber
[dictionarysetObject:[NSNumber numberWithInt:1]forKey:@"messageStatus*****ForBack"];
11.好的电子书
iPhone开发入门经典
美(johnray 著seanJohnson 袁国忠译)
人民邮电出版社
12.简单的网络读出数据
NSString*userName1=[self EncodeGB2312Str:username];
NSString*strUrl = [NSString stringWithFormat:@"%@allFriend.asp?username=%@",ServerAddress,userName1];
NSMutableURLRequest*request = [[NSMutableURLRequest alloc]initWithURL:[NSURL URLWithString:strUrl]];
//[requestsetHTTPMethod:@"POST"];
NSData*returnData = [[NSData alloc]initWithData:[NSURLConnection sendSynchronousRequest:requestreturningResponse:nil error:nil]];
[requestrelease];
NSStringEncodingenc = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000);
NSString*returnString=[[NSString alloc]initWithData:returnDataencoding:enc];
[returnDatarelease];
if([returnString length]>42){
returnString=[returnStringsubstringFromIndex:42];
}
else{
NSLog(@"returnString数据不对");
}
NSError*error;
NSDictionary*dict= [XMLReader dictionaryForXMLString:returnStringerror:&error];
returndict ;
13.简体中文编码
NSStringEncodingenc = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000);
NSString*returnString=[[NSString alloc]initWithData:buf encoding:enc];
14.《斯坦福:iphone开发教程》[中英双语字幕]
15.
http://v.163.com/special/opencourse/iphonekaifa.html
《斯坦福:iphone开发教程》[中英双语字幕]
更新至第10集
16.GDataXMLDocument转成string类型
doc =[[GDataXMLDocument alloc] initWithRootElement:element];
{
NSString *xmlStr= [[NSString alloc] initWithData:[doc XMLData]encoding:NSUTF8StringEncoding];
NSLog(@"%@",xmlStr);
[xmlStr release];
}
[doc release];
doc = nil;
17.循环依赖
@class SmsProcessor;
18.CocoaData
NDGroup*group = [NDGroupAccessor groupWithID:groupID];
NSSet*set = [group unityMessages];
NSMutableArray*array = nil;
for(UnityMessage*msg inset) {
if(msg.msgType== SMS){
[arrayaddObject:msg];
}
}
19.数据库操作
/**
Methodto get smses from group
@paramgroupID a unique identification of group
@returnsa Sms of NSArray
*/
-(NSArray*)smsesFromGroupID:(NSString*)groupID
{
if(groupID == nil){
return nil;
}
[self resetLastError];
NSError*error = nil;
MegaFonModel*megaFonModel = [MegaFonModel sharedModel];
NSFetchRequest*fetchRequest =[[NSFetchRequest alloc]init];
NSEntityDescription*entity=[NSEntityDescription
entityForName:@"SMS"
inManagedObjectContext:megaFonModel.managedObjectContext];
[fetchRequestsetEntity:entity];
//设置条件
NSPredicate*predicate = [NSPredicate predicateWithFormat:@"(groupID= %@)",groupID];
[fetchRequestsetPredicate:predicate];
NSArray*array = [megaFonModel.managedObjectContext executeFetchRequest:fetchRequesterror:&error];
[fetchRequestrelease];
if(error) {
_lastError= [error retain];
array= nil;
}
if(!error&&[arraycount]>=1){
returnarray;
}
return nil;
}
20.改变scroolview的位置
[self.tableView setContentOffset:CGPointMake(0,50.f)animated:NO];
21.设置Button字体设置
UIButton*btn=[[UIButton alloc]initWithFrame:CGRectMake(0,0,60,50)];
[btnsetTitle:@"124" forState:UIControlStateNormal];
btn.titleLabel.font=[UIFont systemFontOfSize:19];
[self.view addSubview:btn];
22.UITextField
UITextField*fieldPwd=[[UITextField alloc]initWithFrame:CGRectMake(65,40,200,25)];
fieldPwd.borderStyle=UITextBorderStyleRoundedRect;
fieldPwd.keyboardType=UIKeyboardTypeASCIICapable;
fieldPwd.secureTextEntry= YES;
fieldPwd.text=@"sara@gmail.com";
[cell.contentView addSubview:fieldPwd];
[fieldPwdrelease];
fieldPwd=nil;
23.tableview下拉不上升
-(void)viewWillAppear:(BOOL)animated{
[superviewWillAppear:animated];
[table_viewsetContentOffset:CGPointMake(0, 44) animated:NO];
NSIndexPath*tableSelection = [table_view indexPathForSelectedRow];
[table_viewdeselectRowAtIndexPath:tableSelection animated:NO];
}