멀티태스킹을 사용하지 않고 바로 종료하기

Supporting Files - Info.plist 에 "Application does not run in background" 를 YES 로 설정. 없으면 추가.


멀티태스킹 지원 체크하기

- (bool)multitaskingAvailable
{
    UIDevice *device = [UIDevice currentDevice];
    if ([device respondsToSelector:@selector(isMultitaskingSupported)])
        return [device getMultitaskingSupported];
    return NO;
}


UIBackgroundModes

백그라운드 실행형태.
Supporting Files - Info.plist 에 "Required background modes" 키와 값을 추가한다.

1. audio : 백그라운드시 멈추지 않는다.
2. location : OS 에 의해 주기적으로 깨어난다.
   applicationDidEnterBackground 에서 startMonitoringSignificantLocationChanges 를 호출하여 정확도를 낮춰 배터리 소모를 줄이도록 한다.
3. voip : OS 가 네트워크 소켓을 감시하다가 전화가 걸려오면 깨운다.


'Mobile > iOS' 카테고리의 다른 글

[iOS] iOS Application Life-cycle  (0) 2012.02.17
[iOS] boolean type  (0) 2012.02.17
[iOS] Gesture Recognizer  (0) 2012.02.16
[iOS] Touches  (0) 2012.02.16
[iOS] 회전  (0) 2012.02.08
UITapGestureRecognizer : 1회 이상의 잠깐 누르기 인식.
UIPinchGestureRecognizer : 핀치 줌 인식. scale, velocity.
UIPanGestureRecognizer : Dragging, Panning (휘젓기) 인식.
UISwipeGestureRecognizer : 미는 동작 인식.
UIRotationGestureRecognizer : 회전 제스처 인식. rotation, velocity.
UILongPressGestureRecognizer : 1개 이상의 길게 누르기 인식.

주의: Pan 과 Swipe 가 동시에 적용되었을 시 대부분의 Swipe 동작은 Pan 으로 인식 될 것이므로 동시에 사용시 주의 필요.

'Mobile > iOS' 카테고리의 다른 글

[iOS] boolean type  (0) 2012.02.17
[iOS] Multitasking  (0) 2012.02.17
[iOS] Touches  (0) 2012.02.16
[iOS] 회전  (0) 2012.02.08
[iOS] 키보드 숨기기  (0) 2012.02.08
[[touches anyObject] count]; // 터치된 점의 개수.
[[touches anyObject] tapCount]; // 연속 터치 회수.
[[touches anyObject] locationInView:[self view]]; // self.view 의 터치된 좌표.

'Mobile > iOS' 카테고리의 다른 글

[iOS] boolean type  (0) 2012.02.17
[iOS] Multitasking  (0) 2012.02.17
[iOS] Gesture Recognizer  (0) 2012.02.16
[iOS] 회전  (0) 2012.02.08
[iOS] 키보드 숨기기  (0) 2012.02.08
1. ViewController 에서 shouldAutorotateToInterfaceOrientation 를 재정의 한다. 기본적으로 다음과 같이 재정의 되어있다.

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}

YES 를 반환할 경우 모든 방향으로 회전이 된다.

방향상수

1. UIInterfaceOrientationPortrait: 세로. 기본상태
2. UIInterfaceOrientationPortraitUpsideDown: 세로. 아래쪽이 위를 향하게 뒤집힘.
3. UIInterfaceOrientationLandscapeRight: 가로. 우측면이 위로 향함.
4. UIInterfaceOrientationLandscapeLeft: 가로. 좌측면이 위로 향함.
 

 

 2. 회전시 처리
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
 

'Mobile > iOS' 카테고리의 다른 글

[iOS] boolean type  (0) 2012.02.17
[iOS] Multitasking  (0) 2012.02.17
[iOS] Gesture Recognizer  (0) 2012.02.16
[iOS] Touches  (0) 2012.02.16
[iOS] 키보드 숨기기  (0) 2012.02.08
1. TextField 의 "Did End On Exit" 에 연결하면 "Return" 을 눌렀을 경우 동작한다.

- (IBAction)textFieldReturn:(id)sender
{
    [sender resignFirstResponder];
}



2. View 의 클래스를 UIView 에서 UIControl 로 변경 후 "Touch Down" 에 연결하면 배경을 눌렀을 경우 동작한다. 이 경우 View 가 FirstResponder 이므로 자식 컨트롤에 대하여 resignFirstResponder 를 수행한다.

- (IBAction)backgroundTouched:(id)sender
{
    [textField resignFirstResponder];
}


 

'Mobile > iOS' 카테고리의 다른 글

[iOS] boolean type  (0) 2012.02.17
[iOS] Multitasking  (0) 2012.02.17
[iOS] Gesture Recognizer  (0) 2012.02.16
[iOS] Touches  (0) 2012.02.16
[iOS] 회전  (0) 2012.02.08

+ Recent posts