ChangePhotoPopupView.m 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. //
  2. // ChangePhotoPopupView.m
  3. // OneCable
  4. //
  5. // Created by nComz on 2017. 4. 26..
  6. // Copyright © 2017년 ntels. All rights reserved.
  7. //
  8. #import "ChangePhotoPopupView.h"
  9. #import "ImageUtil.h"
  10. #import "JDFacade.h"
  11. @interface ChangePhotoPopupView ()<UINavigationControllerDelegate, UIImagePickerControllerDelegate>
  12. @end
  13. @implementation ChangePhotoPopupView
  14. - (id)initFromNib {
  15. for (UIView *view in [CommonUtil nibViews:@"ChangePhotoPopupView"]) {
  16. if ([view isKindOfClass:[ChangePhotoPopupView class]]) {
  17. self = (ChangePhotoPopupView *)view;
  18. //XIB의 경우, 현재 화면 사이즈로 맞춰줘야 함.
  19. self.frame = [UIScreen mainScreen].bounds;
  20. self.lblTitle.text = NSLocalizedString(@"사진 선택", @"사진 선택");
  21. [self.imgTitleBar setImage:[UIImage imageNamed:@"img_popup_bg_head"]inset:UIEdgeInsetsMake(kfTopInset,kfRightInset,kfBottomInset,kfLeftInset)];
  22. [self.btnCancelSingle setBackgroundImage:[UIImage imageNamed:@"img_popup_btn"] forState:UIControlStateNormal capInsets:UIEdgeInsetsMake(kfTopInset,kfRightInset,kfBottomInset,kfLeftInset)];
  23. [self.btnCancelSingle setBackgroundImage:[UIImage imageNamed:@"img_popup_btn_press"] forState:UIControlStateHighlighted capInsets:UIEdgeInsetsMake(kfTopInset,kfRightInset,kfBottomInset,kfLeftInset)];
  24. //Localization
  25. [self.btnCancelSingle setTitle:NSLocalizedString(@"취소", @"취소") forState:UIControlStateNormal];
  26. }
  27. }
  28. return self;
  29. }
  30. - (IBAction)btnPhotoSelectTouched:(id)sender {
  31. NSLog(@"갤러리로 이동");
  32. }
  33. - (IBAction)btnTakePhotoTouched:(id)sender {
  34. NSLog(@"사진 촬영");
  35. if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
  36. // 인스턴스 생성
  37. UIImagePickerController* imagePickerController = [[UIImagePickerController alloc] init];
  38. // 이미지 소스에 카메라를 지정
  39. imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
  40. // 촬영 후에 편집 불가능
  41. imagePickerController.allowsEditing = NO;
  42. // 델리게이트를 이 클래스에 지정
  43. imagePickerController.delegate = self;
  44. // 시작
  45. }
  46. }
  47. - (IBAction)btnPhotoDeleteTouched:(id)sender {
  48. NSString *msg = @"사진이 삭제 되었습니다.";
  49. [[JDFacade facade] alertTitle:@"알림" message: msg completionHander:nil];
  50. }
  51. - (IBAction)btnCancelTouched:(id)sender {
  52. [super btnCancelTouched:nil];
  53. }
  54. @end