//
//  ChangePhotoPopupView.m
//  OneCable
//
//  Created by nComz on 2017. 4. 26..
//  Copyright © 2017년 ntels. All rights reserved.
//
#import "ImageUtil.h"
#import "ChangePhotoPopupView.h"
#import "JDFacade.h"
#import "RequestHandler.h"

@interface ChangePhotoPopupView ()<UINavigationControllerDelegate, UIImagePickerControllerDelegate> {
    
    UIViewController *_presentedViewController;
    UIImagePickerController *_imagePickerController;

}


@end

@implementation ChangePhotoPopupView

- (id)initFromNib {
    
    for (UIView *view in [CommonUtil nibViews:@"ChangePhotoPopupView"]) {
        if ([view isKindOfClass:[ChangePhotoPopupView class]]) {
            self = (ChangePhotoPopupView *)view;
            
            //XIB의 경우, 현재 화면 사이즈로 맞춰줘야 함.
            self.frame = [UIScreen mainScreen].bounds;
            self.lblTitle.text = NSLocalizedString(@"사진 선택", @"사진 선택");
            
            [self.imgTitleBar setImage:[UIImage imageNamed:@"img_popup_bg_head"]inset:UIEdgeInsetsMake(kfTopInset,kfRightInset,kfBottomInset,kfLeftInset)];

            [self.btnCancelSingle setBackgroundImage:[UIImage imageNamed:@"img_popup_btn"] forState:UIControlStateNormal capInsets:UIEdgeInsetsMake(kfTopInset,kfRightInset,kfBottomInset,kfLeftInset)];

            [self.btnCancelSingle setBackgroundImage:[UIImage imageNamed:@"img_popup_btn_press"] forState:UIControlStateHighlighted capInsets:UIEdgeInsetsMake(kfTopInset,kfRightInset,kfBottomInset,kfLeftInset)];

    
            //Localization
            [self.btnCancelSingle setTitle:NSLocalizedString(@"취소", @"취소") forState:UIControlStateNormal];
        }
    }
    
    return self;
}

- (IBAction)btnPhotoSelectTouched:(id)sender {
    [self.delegate changeSelectPhotoType:0];
    [super btnCancelTouched:nil];
}

- (IBAction)btnTakePhotoTouched:(id)sender {
    [self.delegate changeSelectPhotoType:1];
    [super btnCancelTouched:nil];
}

- (IBAction)btnPhotoDeleteTouched:(id)sender {
    [self.delegate changeSelectPhotoType:2];
    [super btnCancelTouched:nil];
}

- (IBAction)btnCancelTouched:(id)sender {
    [super btnCancelTouched:nil];
}


@end
