随笔分类 -  iPhone开发

摘要://按钮事件-(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-03-29 12:00 凡娃软件 阅读(722) 评论(0) 推荐(0)
摘要://Web Service Call NSString *soapMessage = [NSString stringWithFormat: @"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" "<SOAP-ENV:Envelope \n" "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" \n" ... 阅读全文
posted @ 2012-03-16 17:42 凡娃软件 阅读(335) 评论(0) 推荐(0)
摘要:一般都是开启arc功能,毕竟不需要自己手动去释放,是一件比较轻松的事情。但是我们在引用第三方的时候,基本上都是带release与retain的方法,这个时候代码编译就通不过我们可以设置部分文件不使用arc,这样就可以兼容了。步骤:1.在builde phases 中,compile sources 2.选中文件,双击文件,在弹出框中输入-fno-objc-arc,3.编译就可以通过了 阅读全文
posted @ 2012-03-12 16:00 凡娃软件 阅读(323) 评论(0) 推荐(0)
摘要:谢谢lamo的提醒,这个5.0确实无效。//添加5.0下需加入的代码 if ([self.navigationController.navigationBar respondsToSelector:@selector( setBackgroundImage:forBarMetrics:)]){ [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"check_yes.png"] forBarMetrics:UIBarMetricsDefault]; [... 阅读全文
posted @ 2012-03-07 10:09 凡娃软件 阅读(410) 评论(1) 推荐(0)
摘要:1.换颜色 CGRect frame = CGRectMake(0, 0, 320, 47);UIView *v = [[UIView alloc] initWithFrame:frame];UIColor *c = [[UIColoralloc] initWithRed:0.4green:0.7blue:0.3alpha:1.0]; v.backgroundColor = c;[tabBarController.tabBarinsertSubview:v atIndex:0];2.换图片UIImageView* image = [[UIImageViewalloc] initWithIm.. 阅读全文
posted @ 2012-03-06 15:44 凡娃软件 阅读(402) 评论(0) 推荐(0)
摘要:- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ self.window = [[UIWindowalloc] initWithFrame:[[UIScreenmainScreen] bounds]]; self.window.backgroundColor = [UIColorwhiteColor]; //生成各个视图控制器 MedicalData* aa = [[MedicalDataalloc]init]; ... 阅读全文
posted @ 2012-03-06 09:56 凡娃软件 阅读(2571) 评论(0) 推荐(0)
摘要:- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.window.backgroundColor = [UIColor whiteColor]; //生成各个视图控制器 MedicalData* aa = [[MedicalData... 阅读全文
posted @ 2012-03-05 15:45 凡娃软件 阅读(447) 评论(0) 推荐(0)
摘要://创建文件-(void)CreateFile:(NSString*)path fileName:(NSString*)filename{ //创建文件管理器 NSFileManager *fileManager = [NSFileManager defaultManager]; //更改到待操作的目录下 [fileManager changeCurrentDirectoryPath:[path stringByExpandingTildeInPath]]; //创建文件fileName文件名称,contents文件的内容,如果开始没有内容可以设置为nil,attributes文... 阅读全文
posted @ 2012-03-05 10:56 凡娃软件 阅读(368) 评论(0) 推荐(0)
摘要: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 凡娃软件 阅读(527) 评论(0) 推荐(0)
摘要:http://files.cnblogs.com/fanwa/iphone_download.zip 阅读全文
posted @ 2012-03-01 09:42 凡娃软件 阅读(430) 评论(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 凡娃软件 阅读(360) 评论(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 凡娃软件 阅读(411) 评论(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 凡娃软件 阅读(1537) 评论(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 凡娃软件 阅读(334) 评论(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 凡娃软件 阅读(318) 评论(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 凡娃软件 阅读(277) 评论(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 凡娃软件 阅读(650) 评论(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 凡娃软件 阅读(1423) 评论(0) 推荐(0)
摘要:%@ Object%d, %i signed int%u unsigned int%f float/double%x, %X hexadecimal int%o octal int%zu size_t%p pointer%e float/double (in scientific notation)%g float/double (as %f or %e, depending on value)%s C string (bytes)%S C string (unichar)%.*s Pascal string (requires two arguments, pass pstr[0] as t 阅读全文
posted @ 2012-02-15 17:46 凡娃软件 阅读(469) 评论(0) 推荐(1)
摘要:str=[str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; 阅读全文
posted @ 2012-02-15 13:01 凡娃软件 阅读(791) 评论(0) 推荐(0)