摘要: 1.添加framework:将SystemConfiguration.framework 添加进工程。2.下载https://developer.apple.com/library/ios/samplecode/Reachability/Reachability.zip复制里面的Reachability.h和Reachability.m到项目中调用的代码://判断当前的网络是3g还是wifi-(NSString*)GetCurrntNet{ NSString* result; Reachability *r = [ReachabilityreachabilityWithHostName:@.. 阅读全文
posted @ 2012-03-01 11:09 凡娃软件 阅读(515) 评论(0) 推荐(0) 编辑
摘要: http://files.cnblogs.com/fanwa/iphone_download.zip 阅读全文
posted @ 2012-03-01 09:42 凡娃软件 阅读(408) 评论(0) 推荐(0) 编辑
摘要: //加载本地pdf到webview-(void)loadDocument:(NSString*)documentName inView:(UIWebView*)webView{ NSString *path = [[NSBundle mainBundle] pathForResource:documentName ofType:nil]; NSURL *url = [NSURL fileURLWithPath:path]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; [webView loadRequest:re... 阅读全文
posted @ 2012-02-29 17:10 凡娃软件 阅读(342) 评论(0) 推荐(0) 编辑
摘要: //判断是ipad还是iphone-(BOOL)IsIPhone{ BOOL isPhone = NO; if(UI_USER_INTERFACE_IDIOM()) isPhone = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone); return isPhone;} 阅读全文
posted @ 2012-02-29 13:55 凡娃软件 阅读(393) 评论(0) 推荐(0) 编辑
摘要: //按钮事件-(IBAction)btnRead{ UIAlertView* a=[[UIAlertViewalloc]init]; a=[[UIAlertViewalloc] initWithTitle:@"b"message:@"s"delegate:selfcancelButtonTitle:@"确定"otherButtonTitles: @"取消",nil]; [a show];}//定义的委托,buttonindex就是按下的按钮的index值- (void)alertView:(UIAlertView 阅读全文
posted @ 2012-02-28 14:12 凡娃软件 阅读(1523) 评论(0) 推荐(0) 编辑
摘要: NSArray* arr=[@"asd;asdasd;dfd;gd;s;as;daf"componentsSeparatedByString:@";"]; for (int i=0; i<arr.count; i++) { NSString* str=[arr objectAtIndex:i]; NSLog(@"%@",str); } 阅读全文
posted @ 2012-02-28 10:26 凡娃软件 阅读(323) 评论(0) 推荐(0) 编辑
摘要: NSString * str=[[NSStringalloc]init]; str=@"1234567890"; NSRange r; r=[str rangeOfString:textview.text]; if (r.location!=NSNotFound) { NSLog(@"found at location = %d,length = %d",r.location,r.length); } else { NSLog(@"not found"); } 阅读全文
posted @ 2012-02-27 16:42 凡娃软件 阅读(307) 评论(0) 推荐(0) 编辑
摘要: //获取文件路径 NSString *path = [[NSBundlemainBundle] pathForResource:@"user.plist"ofType:@""]; //获取数据 NSMutableDictionary* dict = [ [ NSMutableDictionaryalloc ] initWithContentsOfFile:path ]; NSString* object = [ dict objectForKey:@"aaa" ]; NSLog(object); //修改数据 NSMutableDic 阅读全文
posted @ 2012-02-27 14:56 凡娃软件 阅读(254) 评论(0) 推荐(0) 编辑
摘要: //判断文件是否存在 if(![c judgeFileExist:@"user.plist"]) { NSLog(@"请确认该文件是否存在!"); return; }//判断文件是否存在-(BOOL)judgeFileExist:(NSString * )fileName{ //获取文件路径 NSString *path = [[NSBundle mainBundle] pathForResource:fileName ofType:@""]; if(path==NULL) return NO; returnYES;} 阅读全文
posted @ 2012-02-27 14:55 凡娃软件 阅读(630) 评论(0) 推荐(0) 编辑
摘要: xml字符串为:<users> <user name="hoge" age="20" /> <user name="fuga" age="30" /></users>//解析按钮事件-(IBAction)btnXml{ NSString* str= [uitextview1 text]; //string转成data NSData *xmlData = [str dataUsingEncoding: NSUTF8StringEncoding]; //对xml进行解析需 阅读全文
posted @ 2012-02-24 13:03 凡娃软件 阅读(1414) 评论(0) 推荐(0) 编辑