02 2012 档案
摘要://加载本地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...
阅读全文
摘要://判断是ipad还是iphone-(BOOL)IsIPhone{ BOOL isPhone = NO; if(UI_USER_INTERFACE_IDIOM()) isPhone = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone); return isPhone;}
阅读全文
摘要://按钮事件-(IBAction)btnRead{ UIAlertView* a=[[UIAlertViewalloc]init]; a=[[UIAlertViewalloc] initWithTitle:@"b"message:@"s"delegate:selfcancelButtonTitle:@"确定"otherButtonTitles: @"取消",nil]; [a show];}//定义的委托,buttonindex就是按下的按钮的index值- (void)alertView:(UIAlertView
阅读全文
摘要: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); }
阅读全文
摘要: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"); }
阅读全文
摘要://获取文件路径 NSString *path = [[NSBundlemainBundle] pathForResource:@"user.plist"ofType:@""]; //获取数据 NSMutableDictionary* dict = [ [ NSMutableDictionaryalloc ] initWithContentsOfFile:path ]; NSString* object = [ dict objectForKey:@"aaa" ]; NSLog(object); //修改数据 NSMutableDic
阅读全文
摘要://判断文件是否存在 if(![c judgeFileExist:@"user.plist"]) { NSLog(@"请确认该文件是否存在!"); return; }//判断文件是否存在-(BOOL)judgeFileExist:(NSString * )fileName{ //获取文件路径 NSString *path = [[NSBundle mainBundle] pathForResource:fileName ofType:@""]; if(path==NULL) return NO; returnYES;}
阅读全文
摘要: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进行解析需
阅读全文
摘要:public static T CreateObject(string className){ var typeName=assemblyString+"."+className; var objType=(T)Assembly.Load(assemblyString).CreateInstance(typeName);}
阅读全文
摘要:%@ 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
阅读全文
摘要:str=[str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
阅读全文
摘要://asp.net中的web.config中,需要开启get方式或者post方式<system.web> <webServices> <protocols> <add name="HttpSoap"> <add name="HttpPost"> <add name="HttpGet"> <add name="Documentation"> </protocols> </webService></syst
阅读全文
摘要:-(IBAction)addPicEvent{ UIImagePickerControllerSourceType sourceType=UIImagePickerControllerSourceTypeCamera; if (![UIImagePickerControllerisSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) { sourceType=UIImagePickerControllerSourceTypePhotoLibrary; } UIImagePickerController * pi...
阅读全文
摘要:先添加一个委托_webView.delegate=self;出现if (alertView==nil){ alertView = [[UIAlertViewalloc] initWithTitle:nil message: @"正在讀取網路資料" delegate: self cancelButtonTitle: nil otherButtonTitles: nil]; UIActivityIndicatorView *a...
阅读全文
摘要:-(IBAction)btnStartClick{ proValue=0; timer = [NSTimerscheduledTimerWithTimeInterval:0.001target:selfselector:@selector(changeProgress) userInfo:nilrepeats:YES];}-(void)changeProgress{ proValue +=1.0; if(proValue > 1500) { //停用计时器 [timer invalidate]; } else { [proView setProgres...
阅读全文
摘要:thOne=[[NSThreadalloc]initWithTarget:selfselector:@selector(run) object:nil];[thOne start];-(void)run{ //代码}
阅读全文
摘要:模拟器有这个问题,真机不会,经试验是TextField的Correction属性引起的,把这个属性设为NO就好了
阅读全文
摘要:挡住的处理事件地址在:http://www.cnblogs.com/fanwa/archive/2012/02/14/2350667.html以下是还原的处理事件:注册监听事件:[[NSNotificationCenterdefaultCenter] addObserver:selfselector:@selector(keyboardWillBeHidden:) name:UIKeyboardWillHideNotificationobject:nil];事件代码:- (void)keyboardWillBeHidden:(NSNotification*)aNotification { ..
阅读全文
摘要:新的方式:- (IBAction)textFieldDidBeginEditing:(UITextField *)textField { activeText = textField; [self slideFrame:YES];}- (IBAction)textFieldDidEndEditing:(UITextField *)textField { activeText = nil; [self slideFrame:NO];}-(void) slideFrame:(BOOL) up{ int movementDistance = 0; // twea...
阅读全文
摘要:txtUser.borderStyle=UITextBorderStyleRoundedRect;
阅读全文
摘要:UIWebView* web=[[UIWebViewalloc]initWithFrame:CGRectMake(0,0,320,460)];NSURL*url =[NSURLURLWithString:@"http://www.fanwa.net"]; NSURLRequest*request =[NSURLRequestrequestWithURL:url]; [webloadRequest:request];[self.viewaddSubview:web];
阅读全文
摘要://添加uinav上的按钮UIBarButtonItem* rbutton=[[UIBarButtonItemalloc] initWithTitle:@"登录"style:UIBarButtonItemStyleDonetarget:selfaction:@selector(btnLogin)];self.navigationItem.rightBarButtonItem=rbutton;UIBarButtonItem* lbutton=[[UIBarButtonItemalloc] initWithTitle:@"退出"style:UIBarButt
阅读全文
摘要:1.在AppDelegate.m实现的事件代码,用UINavigationController来进行页面之间的切换- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions{ self.window=[[UIWindowalloc]initWithFrame:[[UIScreenmainScreen]bounds]]; self.window.backgroundColor=[UIColorwhiteColor]; rootView* r=[
阅读全文
浙公网安备 33010602011771号