NSError * error; NSString * pattern = @"\\d+"; NSRegularExpression * ex = [NSRegularExpression regularExpressionWithPattern:pattern options:NSRegularExpressionCaseInsensitive error:&error]; NSString * str = @"1,234,5678,90123,456789"; NSArray * matches = [ex matchesInString:str options:NSMatchingReportProgress range:NSMakeRange(0, [str length])]; for (NSTextCheckingResult * ret in matches) { NSL..
구성형태 : 반환 타입, 블록 이름, 인자 ex) (void)(^ nameBlock)(void) (반환타입)(^블록 이름)(인자) sample) 1. head 선언 - (void)showNameUsingBlock:(void (^)(NSString * name))block; 2. 구현 - (void)showNameUsingBlock:(void (^)(NSString *))block { block(self.name); } 3. 호출 MyBlock * block = [[MyBlock alloc] init]; [block showNameUsingBlock:^(NSString * name) { NSLog(@"내 이름은 %@", name); }]; [block release]; 4. 블록 외부의 값을 수정할때 : ..
NSString * yourImageUrl = [@"URL" stringByAppendingString:yourfile]; NSString * imageName = @"yourImage.png"; NSURL * yourUrl = [NSURL URLWithString:yourImageUrl]; NSData * yourdata = [NSData dataWithContentsOfURL:yourUrl]; UIImage * image = [[UIImage alloc] initWithData:yourdata]; UIImage * scaledImage = [image scaleToSize:CGSizeMake(MYIMAGEWIDTH, MYIMAGEHEIGHT)]; //scaleToSize Method는 따로 정의 NS..
1. textField클릭시 처리 :view를 하나 만들어서 올리는거처럼 보이게 한다. - (void)keyboardWillShow:(NSNotification *)notice { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.3]; CGRect rect = self.view.frame; rect.origin.y -= 215; rect.size.height += 215; self.view.frame = rect; [UIView commitAnimations]; } 2. 리턴 버튼 클릭시 처리 :만들어진 view의 y좌표를 조절하여 내리는거처럼 보이게 한다. - (BOOL)textFieldShouldReturn:(UITe..
//------------------------------------------------ // 추출 //------------------------------------------------ // a태그 관련 추출하기 preg_match_all("|]+>(.*)|U",$str,$out1, PREG_PATTERN_ORDER); preg_match_all("|]+>.*|U",$str,$out2, PREG_PATTERN_ORDER); preg_match_all("^]*>/i", $str, $out5); //------------------------------------------------ // 처음 나온는 이미지 추출(jpg,gif,png) //---------------------------------..