04. Window 개발


HONE Smart Platform 은 앱 화면을 구성하기 위한 기본 윈도우로 HMPWindow, HMPPopupWebWindow, HMPWebWindow, HMPPopupWindow 4종류의 Window를 제공한다.

Window는 하나의 UIViewController로 구성되며, HONE Smart Platform 내 생성된 UINavigationController 위에서 각 Window들이 교체되는 방식으로 앱 화면을 구현한다.

Table. 지원 Window 종류

NoClass NameRemark
1HMPWindow기본 Native Window
2HMPWebWindow기본 Web Window
3HMPPopupWindow팝업 Native Window
4HMPPopupWebWindow팝업 Web Window

Native측의 Window 개발

스토리보드를 이용한 Window 개발 방법은 Storyboard 가이드 의 내용을 참조한다.

추가하고자 하는 Window의 종류에 따라 상속받는 Class를 선택하여 개발한다.
다음은 HMPWebWindow를 상속받아 추가 Web Window 생성 방법을 설명한다.

Picture33.png

  1. Project 선택
  2. New Group 메뉴 선택
  3. windows 입력
  4. windows Group 폴더
  5. New File 메뉴 선택

 

Picture35.png

  1. iOS - Source - Cocoa Touch Class 선택
  2. Next 버튼 선택

 

Picture36.png

  1. Class명 입력 (CustomWindow로 가정)
  2. Subclass of 항목에 HMPWebWindow작성
  3. Next 버튼 선택

 

Picture37.png

  1. Windows 폴더 생성
  2. Windows 폴더 선택
  3. Create 버튼 선택

 

View Customizing

제품 화면에 커스텀 화면이 필요한 경우 각 클래스마다 접근 해야 하는 부모 변수가 다르다.

Table. 접근 부모 변수

NoClass Name부모 변수
1HMPWindowself.view
2HMPWebWindowself.view
3HMPPopupWindowself.contentView
4HMPPopupWebWindowself.contentView

window.json 내 Custom Window 추가

앱 시동 시 해당 Window의 인스턴스를 생성하기 위해 window.json 파일에 Window 정보를 추가한다.

 

Example

{
   "customWindow": {
       "className": "CustomWindow"
    },
   "defaultWebWindow": {
       "className": "HMPWebWindow"
    },
   "defaultWebPopupWindow": {
       "className": "HMPPopupWebWindow"
    },
   "defaultWindow": {
       "className": "HMPWindow"
    },
   "defaultPopupWindow": {
       "className": "HMPPopupWindow"
    }
}

Window 이동

아래 윈도우 정보를 전달하면 윈도우를 이동할 수 있다.
지정할 수 있는 윈도우 옵션은 아래와 같다. 

1. 대상 윈도우 이름

2. BizApp 화면 경로 또는 오픈할 URL 경로

3. animation 사용 옵션 

특정 비즈앱으로 이동

비즈앱으로 이동하기 위해서는 윈도우 이름과 BizApp 화면 경로, 기본 애니메이션 사용 여부를 설정하면 된다.

 

Example

DAPWindow.show("customWindow", url: "index.html", params: nil, animated: false, completion: { resultDict in
}, failure: { error in
})
[DAPWindow showWindow:@"customWindow" url:@"index.html" params:nil animated:NO completion:^(NSDictionary *resultDict) {
    } failure:^(NSError *error) {
}];

특정 URL 로 이동

특정 URL 로 이동하려면 윈도우 이름과 url, 기본 애니메이션 사용 여부를 설정하면 된다. 

Example

DAPWindow.show("customWindow", url: "https://google.com", params: nil, animated: false, completion: { resultDict in
}, failure: { error in
})
[DAPWindow showWindow:@"customWindow" url:@"https://google.com" params:nil animated:NO completion:^(NSDictionary *resultDict) {
    } failure:^(NSError *error) {
}];

Animation

HSP 에서 윈도우간 이동을 할 때 동적인 화면을 제공하기 위해 Animation 기능을 제공 한다. animated 파라미터를 이용하여 설정할 수 있으며 인자 값은 다음과 같다.

true : 기본 애니메이션 사용

false : 기본 애니메이션 미사용

Example

DAPWindow.show("customWindow", url: "https://google.com", params: nil, animated: true, completion: { resultDict in
}, failure: { error in
})
[DAPWindow showWindow:@"customWindow" url:@"https://google.com" params:nil animated:YES completion:^(NSDictionary *resultDict) {
    } failure:^(NSError *error) {
}];