| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- //
- // TriggerSelectPopupView.m
- // kneet2
- //
- // Created by Jason Lee on 11/23/15.
- // Copyright (c) 2015 ntels. All rights reserved.
- //
- #import "JDObject.h"
- #import "CustomLabel.h"
- #import "CustomButton.h"
- #import "TriggerSelectPopupView.h"
- #import "DeviceSelectPopupView.h"
- #import "DeviceNodePopupView.h"
- @interface TriggerSelectPopupView () {
-
- NSMutableArray<ItemModel> *_checkedItems;
- }
- @end
- @implementation TriggerSelectPopupView
- - (id)initFromNib {
- for (UIView *view in [CommonUtil nibViews:@"TriggerSelectPopupView"]) {
- if ([view isKindOfClass:[TriggerSelectPopupView class]]) {
- self = (TriggerSelectPopupView *)view;
- //XIB의 경우, 현재 화면 사이즈로 맞춰줘야 함.
- self.frame = [UIScreen mainScreen].bounds;
-
- [_lblTimer addTouchEventHandler:^(id label) {
- [self btnTimerTouched:nil];
- }];
-
- [_lblSun addTouchEventHandler:^(id label) {
- [self btnSunTouched:nil];
- }];
-
- [_lblHeat addTouchEventHandler:^(id label) {
- [self btnHeatTouched:nil];
- }];
-
- [_lblDevice addTouchEventHandler:^(id label) {
- [self btnDeviceTouched:nil];
- }];
-
-
- //Localization
- [self.btnConfirm setTitle:NSLocalizedString(@"확인", @"확인") forState:UIControlStateNormal];
- [self.btnCancel setTitle:NSLocalizedString(@"취소", @"취소") forState:UIControlStateNormal];
- }
- }
- return self;
- }
- - (void)didMoveToSuperview {
-
- }
- #pragma mark - Main Logic
- #pragma mark - UI Events
- - (IBAction)btnTimerTouched:(id)sender {
-
- }
- - (IBAction)btnSunTouched:(id)sender {
-
- }
- - (IBAction)btnHeatTouched:(id)sender {
-
- }
- - (IBAction)btnDeviceTouched:(id)sender {
-
- DeviceSelectPopupView *dpopup = [[DeviceSelectPopupView alloc] initFromNib];
- dpopup.refDevices = _refDevices;
- dpopup.typeCode = ksItemTypeCodeTrigger;
-
- [dpopup showWithCompletion:^(CustomAlertView *alertView, NSInteger buttonIndex) {
- if (buttonIndex == 0) {//ok
- DeviceNodePopupView *npopup = [[DeviceNodePopupView alloc] initFromNib];
- npopup.refDevice = dpopup.selectedDevices[0];
- npopup.typeCode = ksItemTypeCodeTrigger;
-
- [npopup showWithCompletion:^(CustomAlertView *alertView, NSInteger buttonIndex) {
- //action add
- if (buttonIndex == 0) {//OK
- npopup.refDevice.itemSubTypeCode = ksItemSubTypeCodeDevice; //트리거 타입 설정
- [_refTriggers addObject:npopup.refDevice];
- [self btnConfirmTouched:nil];
- }
- }];
- }
- }];
- }
- - (IBAction)btnConfirmTouched:(id)sender {
- //validate
-
- [super btnConfirmTouched:sender];
- }
- @end
|