레이블이 iOS 프로그래밍인 게시물을 표시합니다. 모든 게시물 표시
레이블이 iOS 프로그래밍인 게시물을 표시합니다. 모든 게시물 표시

2014년 6월 9일 월요일

UINavigationBar 폰트 및 바 색상 변경 (iOS 7)

폰트 및 버튼들의 하이라이트 색상 변경은
[[UINavigationBar appearance] setTintColor:[UIColor redColor]];

상단 바 자체의 색상 변경은
[[UINavigationBar appearance] setBarTintColor:[UIColor redColor]];

UITabBar 아이콘 색상 변경 (iOS 7)

[[UITabBar appearance] setTintColor:[UIColor redColor]];
위와 같이 간단히 변경이 가능합니다.

2014년 1월 9일 목요일

window에 추가한 view가 자동 화면 회전을 지원하지 않을때 (iOS)

이런 경우는 주로 window에 추가한 view를 root view 컨트롤러로 지정해 주지 않았을 경우 생깁니다.

해결법은 간단히 self.window.rootViewController = yourViewController 를 해주시면 됩니다.

여기서 기억하실 점은 root view 컨트롤러만이 자동 화면 회전을 지원한다는 점입니다.

2013년 12월 29일 일요일

Xcode 4에서 프로젝트 이름 변경

1. 폴더 아이콘을 클릭합니다.

2. 화면 상단의 프로젝트 파일을 선택합니다.

3. 만일 이미 인스펙터 페인이 활성화되어 있지 않다면 활성화 시킵니다.

4. 인스펙터 페인에서 종이 모양의 아이콘을 선택합니다.

5. 프로젝트 이름을 변경합니다.


2013년 12월 23일 월요일

NSNotification 예제

// remove notification observer
[[NSNotificationCenter defaultCenter] removeObserver:self];

// add notification observer
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(default:) name:kDefault object:nil];

// post notification
[[NSNotificationCenter defaultCenter] postNotificationName:kDefault object:nil];

// post notification with object
NSDictionary* dict = [NSDictionary dictionaryWithObject:_chatField.text forKey:@"chatText"];
        [[NSNotificationCenter defaultCenter] postNotification:
         [NSNotification notificationWithName:@"chatText"
                                       object:self
                                     userInfo:dict]];

// example
- (void)updateLocationOnMapView:(NSNotification *)notification
{
    NSString *chatText = [notification.userInfo objectForKey:@"chatText"];
   
    NSLog(@"received chat text : %@", chatText);
}

2013년 12월 22일 일요일

NSString에 특정 문자열이 있는지 검색하는 간단한 함수

- (BOOL)Contains:(NSString *)strSearchTerm on:(NSString *)strText
{
    return [strText rangeOfString:strSearchTerm options:NSCaseInsensitiveSearch].location==NSNotFound?FALSE:TRUE;
}

NSData를 integer로 변환

int number = *(int*)([data bytes]);