CPDFHeaderFooterSettingController.m 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //
  2. // HeaderFooterSettingViewController.m
  3. // PDFViewer
  4. //
  5. // Created by kdanmobile_2 on 2022/11/21.
  6. //
  7. #import "CPDFHeaderFooterSettingController.h"
  8. @interface CPDFHeaderFooterSettingController ()
  9. @end
  10. @implementation CPDFHeaderFooterSettingController
  11. - (id)initWithIamge:(UIImage *)image WithSize:(CGSize)size WithDocument:(CPDFDocument *)docment WithView:(CPDFView *)pdfView {
  12. self = [super init];
  13. if (self) {
  14. _image = image;
  15. _size = size;
  16. _document = docment;
  17. _pdfView = pdfView;
  18. }
  19. return self;
  20. }
  21. - (void)viewDidLoad {
  22. [super viewDidLoad];
  23. // Do any additional setup after loading the view.
  24. UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
  25. //add headerfooter action
  26. UIAlertAction *addHeaderfooterAction = [UIAlertAction actionWithTitle:@"Add Headerfooter" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  27. self.headerFooterControl = [[CPDFHeaderFooterAddController alloc] initWithIamge:self.image WithSize:self.size WithDocument:self.document WithView:self.pdfView];
  28. [self addChildViewController:self.headerFooterControl];
  29. [self.view addSubview:self.headerFooterControl.view];
  30. [self.navigationController pushViewController:self.headerFooterControl animated:NO];
  31. self.view.hidden = YES;
  32. }];
  33. //delete headerfooter action
  34. UIAlertAction *deleteHeaderfooterAction = [UIAlertAction actionWithTitle:@"Delete Headerfooter" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  35. CPDFHeaderFooterDeleteController *headerFooterDeleteControl = [[CPDFHeaderFooterDeleteController alloc] init];
  36. [self addChildViewController:headerFooterDeleteControl];
  37. [self.view addSubview:headerFooterDeleteControl.view];
  38. }];
  39. //cancel Action
  40. UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
  41. NSLog(@"Cancel Action");
  42. self.view.hidden = YES;
  43. }];
  44. [alertController addAction:addHeaderfooterAction];
  45. [alertController addAction:deleteHeaderfooterAction];
  46. [alertController addAction:cancelAction];
  47. [self presentViewController:alertController animated:YES completion:nil];
  48. }
  49. @end