Objective-C(10)
-
NSDictionary <null> 값 비교 처리
# 방법 1 if([[dictionary objectForKey:@"Field"] isKindOfClass:[NSNull class]]){ } # 방법 2 if ([dictionary objectForKey:@"Field"] == (NSString *)[NSNull null]){ } # 방법 3 if ([dictionary objectForKey:@"Field"] == (id)[NSNull null]) { }
2014.11.25 -
UITextField
## 글자수 입력 제한 Ex) 4자까지만 입력가능] #pragma mark - UITextFieldDelegate - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { NSString *newString = [textField.text stringByReplacingCharactersInRange:range withString:string]; int length = [newString length] ; if (length >= 4) { textField.text = [newString substringToIndex:4]; return..
2014.10.28 -
UITableView
UITableView ## Separator 이슈 if ([m_tableView respondsToSelector:@selector(setSeparatorInset:)]) { [m_tableView setSeparatorInset:UIEdgeInsetsZero]; [m_tableView setSeparatorInset:UIEdgeInsetsMake(0, 0, 0, 0)]; } - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{ if ([tableView respondsToSelector:@selector(setSeparatorIns..
2014.10.28 -
NSDate, NSDateFormat
## 년월일 요일 출력 NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"yyyy년 MM월 dd일 E요일"]; NSLog(@"%@", [dateFormatter stringFromDate:m_datePicker.date]); //-- 2014년 02월 21일 금요일 형식으로 출력됨 ## NSDateFormatter에서 사용가능한 값 yyyy : 년도 w : 일년안에서 몇번째 주인지 W : 한달안에서 몇번째 주인지 MM : 월 dd : 일 D : 일년에서 몇번째 일인지 E : 요일 (ex) Tuesday; Tue F : 요일을 숫자로 (ex) 2 hh : 시간 (12시간 단위로 112..
2014.10.28