|
@@ -0,0 +1,400 @@
|
|
|
+//
|
|
|
+// CPDFBackgroundSettingViewController.m
|
|
|
+// PDFViewer
|
|
|
+//
|
|
|
+// Created by kdanmobile_2 on 2023/1/2.
|
|
|
+//
|
|
|
+
|
|
|
+#import "CPDFBackgroundSettingViewController.h"
|
|
|
+#import "CPDFBackgroundView.h"
|
|
|
+#import "CPDFBackgroundPreview.h"
|
|
|
+#import "CPDFBackgroundSettingView.h"
|
|
|
+#import "CPDFDrawBackgroundView.h"
|
|
|
+#import "CPDFDrawImageView.h"
|
|
|
+#import "Masonry.h"
|
|
|
+#import "UIImage+TintColor.h"
|
|
|
+
|
|
|
+@interface CPDFBackgroundSettingViewController () <UIImagePickerControllerDelegate,UINavigationControllerDelegate,UITextFieldDelegate>
|
|
|
+
|
|
|
+@property (nonatomic,strong) CPDFBackgroundView *backgroundView;
|
|
|
+@property (nonatomic,strong) CPDFBackgroundPreview *backgroundPreView;
|
|
|
+@property (nonatomic,strong) CPDFBackgroundSettingView *backgroudSettingView;
|
|
|
+@property (nonatomic,strong) CPDFDrawImageView *drawImageView;
|
|
|
+@property (nonatomic,strong) CPDFDrawBackgroundView *drawBackgroundView;
|
|
|
+@property (nonatomic,strong) CPDFBackgroundModel *dataModel;
|
|
|
+@property (nonatomic,assign) CGSize imageSize;
|
|
|
+@property (nonatomic,strong) UIImage *image;
|
|
|
+
|
|
|
+@end
|
|
|
+
|
|
|
+@implementation CPDFBackgroundSettingViewController
|
|
|
+
|
|
|
+- (void)viewDidLoad {
|
|
|
+ [super viewDidLoad];
|
|
|
+
|
|
|
+ UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStylePlain target:self action:@selector(onClickedDoneBtn)];
|
|
|
+
|
|
|
+ UIBarButtonItem *editBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:@selector(editClick)];
|
|
|
+
|
|
|
+ UIBarButtonItem *deleteBtn = [[UIBarButtonItem alloc] initWithTitle:@"Delete" style:UIBarButtonItemStylePlain target:self action:@selector(deleteClick)];
|
|
|
+
|
|
|
+ self.navigationItem.rightBarButtonItems = @[doneBtn, editBtn, deleteBtn];
|
|
|
+
|
|
|
+ [self initDataMoel];
|
|
|
+ [self createView];
|
|
|
+ [self addConstraint];
|
|
|
+ [self addTargets];
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark - Initializers
|
|
|
+
|
|
|
+- (instancetype)initWithDocument:(CPDFDocument *)document {
|
|
|
+ self = [super init];
|
|
|
+ if (self) {
|
|
|
+ _document = document;
|
|
|
+
|
|
|
+ CPDFPage *pdfPage = [document pageAtIndex:0];
|
|
|
+ CGSize imageSize = [document pageSizeAtIndex:0];
|
|
|
+ _image = [pdfPage thumbnailOfSize:imageSize];
|
|
|
+ _imageSize = imageSize;
|
|
|
+ }
|
|
|
+ return self;
|
|
|
+}
|
|
|
+
|
|
|
+- (void)createView {
|
|
|
+ _backgroundView = [[CPDFBackgroundView alloc] init];
|
|
|
+ [self.view addSubview:_backgroundView];
|
|
|
+
|
|
|
+ _backgroundPreView = [[CPDFBackgroundPreview alloc] init];
|
|
|
+ [self.view addSubview:_backgroundPreView];
|
|
|
+
|
|
|
+ _backgroundPreView.documentView.image = self.image;
|
|
|
+
|
|
|
+ _drawBackgroundView = [[CPDFDrawBackgroundView alloc] initWithFrame:CGRectMake(0, 40, 393, 598.333)];
|
|
|
+ _drawBackgroundView.dataModel = self.dataModel;
|
|
|
+ [self.backgroundPreView addSubview:_drawBackgroundView];
|
|
|
+
|
|
|
+ _drawImageView = [[CPDFDrawImageView alloc] initWithFrame:CGRectMake(0, 40, 393, 598.333)];
|
|
|
+ [_drawImageView setImage:_image];
|
|
|
+ [self.backgroundPreView addSubview:_drawImageView];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)initDataMoel {
|
|
|
+ _dataModel = [[CPDFBackgroundModel alloc] init];
|
|
|
+ _dataModel.backgroundColor = [UIColor whiteColor];
|
|
|
+ _dataModel.backgroudScale = 1.0f;
|
|
|
+ _dataModel.backgroundOpacity = 1.0f;
|
|
|
+ _dataModel.backgroundRotation = 0.0f;
|
|
|
+ _dataModel.verticalSpacing = 0.0f;
|
|
|
+ _dataModel.horizontalSpacing = 0.0f;
|
|
|
+}
|
|
|
+
|
|
|
+- (void)addConstraint {
|
|
|
+ if ([UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeRight || [UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeLeft || [UIDevice currentDevice].orientation == UIDeviceOrientationPortraitUpsideDown || (self.view.frame.size.width > self.view.frame.size.height)) {
|
|
|
+ [self addSideConstraint];
|
|
|
+ } else {
|
|
|
+ [self addNomalConstraint];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+- (void)addSideConstraint {
|
|
|
+ [_backgroundView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.bottom.equalTo(self.view.mas_bottom).offset(-5);
|
|
|
+ make.left.equalTo(self.view.mas_left);
|
|
|
+ make.right.equalTo(self.view.mas_right);
|
|
|
+ make.height.mas_equalTo(70);
|
|
|
+ }];
|
|
|
+
|
|
|
+ [_backgroundPreView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.top.equalTo(self.view.mas_top).offset(43.6);
|
|
|
+ make.left.equalTo(self.view.mas_left);
|
|
|
+ make.right.equalTo(self.view.mas_right);
|
|
|
+ make.bottom.equalTo(self.backgroundView.mas_top);
|
|
|
+ }];
|
|
|
+
|
|
|
+ [_backgroundPreView.documentView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.top.equalTo(self.view.mas_top).offset(43.6);
|
|
|
+ make.bottom.equalTo(self.backgroundPreView.mas_bottom);
|
|
|
+ make.centerX.equalTo(self.backgroundPreView.mas_centerX);
|
|
|
+ make.width.mas_equalTo(233);
|
|
|
+ }];
|
|
|
+
|
|
|
+ [_drawBackgroundView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.top.equalTo(self.backgroundPreView.documentView.mas_top);
|
|
|
+ make.bottom.equalTo(self.backgroundPreView.documentView.mas_bottom);
|
|
|
+ make.left.equalTo(self.backgroundPreView.documentView.mas_left);
|
|
|
+ make.right.equalTo(self.backgroundPreView.documentView.mas_right);
|
|
|
+ }];
|
|
|
+ [_drawImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.top.equalTo(self.backgroundPreView.documentView.mas_top);
|
|
|
+ make.bottom.equalTo(self.backgroundPreView.documentView.mas_bottom);
|
|
|
+ make.left.equalTo(self.backgroundPreView.documentView.mas_left);
|
|
|
+ make.right.equalTo(self.backgroundPreView.documentView.mas_right);
|
|
|
+ }];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)addNomalConstraint {
|
|
|
+ [_backgroundView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.bottom.equalTo(self.view.mas_bottom).offset(-20);
|
|
|
+ make.left.equalTo(self.view.mas_left);
|
|
|
+ make.right.equalTo(self.view.mas_right);
|
|
|
+ make.height.mas_equalTo(70);
|
|
|
+ }];
|
|
|
+
|
|
|
+ [_backgroundPreView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.top.equalTo(self.view.mas_top).offset(83.6);
|
|
|
+ make.left.equalTo(self.view.mas_left);
|
|
|
+ make.right.equalTo(self.view.mas_right);
|
|
|
+ make.bottom.equalTo(self.backgroundView.mas_top);
|
|
|
+ }];
|
|
|
+
|
|
|
+ [_backgroundPreView.documentView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.equalTo(self.backgroundPreView.mas_left);
|
|
|
+ make.top.equalTo(self.backgroundPreView.mas_top).offset(40);
|
|
|
+ make.bottom.equalTo(self.backgroundPreView.mas_bottom).offset(-40);
|
|
|
+ make.width.mas_equalTo(393);
|
|
|
+ }];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)addTargets {
|
|
|
+ [_backgroundView.selectBtn addTarget:self action:@selector(onSelectBtnClicked:) forControlEvents:UIControlEventTouchDown];
|
|
|
+
|
|
|
+ for (NSInteger i = 0; i < _backgroundView.colorArray.count; ++i) {
|
|
|
+ [_backgroundView.colorArray[i] addTarget:self action:@selector(onColorBtnClicked:) forControlEvents:UIControlEventTouchDown];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark - Actions
|
|
|
+
|
|
|
+- (void)onClickedDoneBtn {
|
|
|
+ [self.delegate changeBackgroundModel:self.dataModel];
|
|
|
+
|
|
|
+ [self.navigationController popViewControllerAnimated:YES];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)editClick {
|
|
|
+
|
|
|
+ if (!([_backgroudSettingView isDescendantOfView:self.view])) {
|
|
|
+ _backgroudSettingView = [[CPDFBackgroundSettingView alloc] init];
|
|
|
+
|
|
|
+ _backgroudSettingView.verticalField.delegate = self;
|
|
|
+ _backgroudSettingView.horizontalField.delegate = self;
|
|
|
+
|
|
|
+ [self.view addSubview:_backgroudSettingView];
|
|
|
+
|
|
|
+ [_backgroudSettingView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.centerX.equalTo(self.backgroundPreView.mas_centerX);
|
|
|
+ make.centerY.equalTo(self.backgroundPreView.mas_centerY);
|
|
|
+ make.height.mas_equalTo(330);
|
|
|
+ make.width.mas_equalTo(320);
|
|
|
+ }];
|
|
|
+
|
|
|
+ [UIView animateWithDuration:0.2 delay:0 options:UIViewAnimationOptionCurveEaseIn animations:^{
|
|
|
+ self.backgroudSettingView.center = CGPointMake(self.backgroudSettingView.center.x, self.backgroudSettingView.center.y - 300);
|
|
|
+ } completion:nil];
|
|
|
+
|
|
|
+ [_backgroudSettingView.pageBtn addTarget:self action:@selector(onSelectPageRange:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ [_backgroudSettingView.doneBtn addTarget:self action:@selector(doneClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ [_backgroudSettingView.cancelBtn addTarget:self action:@selector(cancelClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+
|
|
|
+ [_backgroudSettingView.opacitySlider addTarget:self action:@selector(onOpacityChanged:) forControlEvents:UIControlEventValueChanged];
|
|
|
+ [_backgroudSettingView.scaleSlider addTarget:self action:@selector(onScaleChanged:) forControlEvents:UIControlEventValueChanged];
|
|
|
+ [_backgroudSettingView.rotationSlider addTarget:self action:@selector(onRotationChanged:) forControlEvents:UIControlEventValueChanged];
|
|
|
+
|
|
|
+ [_backgroudSettingView.horizontalField addTarget:self action:@selector(horizontalChange:) forControlEvents:UIControlEventEditingDidEnd];
|
|
|
+ [_backgroudSettingView.verticalField addTarget:self action:@selector(verticalChage:) forControlEvents:UIControlEventEditingDidEnd];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+- (void)deleteClick {
|
|
|
+ [self.delegate deleteBackgroundModel];
|
|
|
+
|
|
|
+ [self.navigationController popViewControllerAnimated:YES];
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark - UI Functions
|
|
|
+
|
|
|
+- (void)onColorBtnClicked:(UIButton *)btn {
|
|
|
+
|
|
|
+ _dataModel.backgroundColor = btn.backgroundColor;
|
|
|
+ _drawBackgroundView.dataModel = self.dataModel;
|
|
|
+ [_drawBackgroundView setNeedsDisplay];
|
|
|
+
|
|
|
+// _backgroundPreView.documentView.image = [_image imageWithTintColor:btn.backgroundColor];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)onSelectBtnClicked:(UIButton *)sender {
|
|
|
+ UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
|
|
|
+ imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
|
|
|
+ imagePicker.delegate = self;
|
|
|
+ imagePicker.allowsEditing = YES;
|
|
|
+ [self presentViewController:imagePicker animated:YES completion:nil];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)onSelectPageRange:(UIButton *)btn {
|
|
|
+ UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
|
|
|
+ UIAlertAction *defaultRange = [UIAlertAction actionWithTitle:@"All Pages" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
|
+ self.backgroudSettingView.rangeLabel.text = @"Page Range: ALL";
|
|
|
+ }];
|
|
|
+ UIAlertAction *customRange = [UIAlertAction actionWithTitle:@"Custom" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
|
+ [self createCustomRangeAlert];
|
|
|
+ }];
|
|
|
+ UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
|
|
|
+
|
|
|
+ }];
|
|
|
+ [alertController addAction:defaultRange];
|
|
|
+ [alertController addAction:customRange];
|
|
|
+ [alertController addAction:cancelAction];
|
|
|
+ [self presentViewController:alertController animated:YES completion:nil];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)createCustomRangeAlert {
|
|
|
+ UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Custom Page Range" message:nil preferredStyle:UIAlertControllerStyleAlert];
|
|
|
+
|
|
|
+ [alertController addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
|
|
|
+ textField.placeholder = @"such as:1,3-5,10";
|
|
|
+ }];
|
|
|
+ [alertController addAction:[UIAlertAction actionWithTitle:@"Done" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
|
+
|
|
|
+ self.dataModel.pageString = alertController.textFields.firstObject.text;
|
|
|
+ self.backgroudSettingView.rangeLabel.text = @"Page Range:Custom";
|
|
|
+ }]];
|
|
|
+ [alertController addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
|
+ }]];
|
|
|
+ [self presentViewController:alertController animated:YES completion:nil];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)doneClick:(UIButton *)btn {
|
|
|
+ _drawBackgroundView.dataModel = self.dataModel;
|
|
|
+
|
|
|
+ [_drawBackgroundView setNeedsDisplay];
|
|
|
+ [_backgroudSettingView removeFromSuperview];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)cancelClick:(UIButton *)btn {
|
|
|
+ [_backgroudSettingView removeFromSuperview];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)onOpacityChanged:(UISlider *)sender {
|
|
|
+ _dataModel.backgroundOpacity = 1 - sender.value;
|
|
|
+}
|
|
|
+
|
|
|
+- (void)onScaleChanged:(UISlider *)sender {
|
|
|
+ _dataModel.backgroudScale = sender.value;
|
|
|
+}
|
|
|
+
|
|
|
+- (void)onRotationChanged:(UISlider *)sender {
|
|
|
+ _dataModel.backgroundRotation = sender.value * 180 / M_PI;
|
|
|
+}
|
|
|
+
|
|
|
+- (void)horizontalChange:(UITextField *)text {
|
|
|
+ _dataModel.horizontalSpacing = [text.text floatValue];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)verticalChage:(UITextField *)text {
|
|
|
+ _dataModel.verticalSpacing = [text.text floatValue];
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark - Orientation
|
|
|
+
|
|
|
+- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
|
|
|
+ [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
|
|
|
+ if ([UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeRight) {
|
|
|
+
|
|
|
+ [_backgroundView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.bottom.equalTo(self.view.mas_bottom).offset(-5);
|
|
|
+ make.left.equalTo(self.view.mas_left);
|
|
|
+ make.right.equalTo(self.view.mas_right);
|
|
|
+ make.height.mas_equalTo(70);
|
|
|
+ }];
|
|
|
+
|
|
|
+ [_backgroundPreView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.top.equalTo(self.view.mas_top).offset(43.6);
|
|
|
+ make.left.equalTo(self.view.mas_left);
|
|
|
+ make.right.equalTo(self.view.mas_right);
|
|
|
+ make.bottom.equalTo(self.backgroundView.mas_top);
|
|
|
+ }];
|
|
|
+
|
|
|
+ [_backgroundPreView.documentView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.top.equalTo(self.backgroundPreView.mas_top);
|
|
|
+ make.bottom.equalTo(self.backgroundPreView.mas_bottom);
|
|
|
+ make.centerX.equalTo(self.backgroundPreView.mas_centerX);
|
|
|
+ make.width.mas_equalTo(233);
|
|
|
+ }];
|
|
|
+
|
|
|
+ [_drawBackgroundView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.top.equalTo(self.backgroundPreView.documentView.mas_top);
|
|
|
+ make.bottom.equalTo(self.backgroundPreView.documentView.mas_bottom);
|
|
|
+ make.left.equalTo(self.backgroundPreView.documentView.mas_left);
|
|
|
+ make.right.equalTo(self.backgroundPreView.documentView.mas_right);
|
|
|
+ }];
|
|
|
+ [_drawImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.top.equalTo(self.backgroundPreView.documentView.mas_top);
|
|
|
+ make.bottom.equalTo(self.backgroundPreView.documentView.mas_bottom);
|
|
|
+ make.left.equalTo(self.backgroundPreView.documentView.mas_left);
|
|
|
+ make.right.equalTo(self.backgroundPreView.documentView.mas_right);
|
|
|
+ }];
|
|
|
+ } else if ([UIDevice currentDevice].orientation == UIDeviceOrientationPortrait) {
|
|
|
+
|
|
|
+ [_backgroundView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.bottom.equalTo(self.view.mas_bottom).offset(-20);
|
|
|
+ make.left.equalTo(self.view.mas_left);
|
|
|
+ make.right.equalTo(self.view.mas_right);
|
|
|
+ make.height.mas_equalTo(70);
|
|
|
+ }];
|
|
|
+
|
|
|
+ [_backgroundPreView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.top.equalTo(self.view.mas_top).offset(83.6);
|
|
|
+ make.left.equalTo(self.view.mas_left);
|
|
|
+ make.right.equalTo(self.view.mas_right);
|
|
|
+ make.bottom.equalTo(self.backgroundView.mas_top);
|
|
|
+ }];
|
|
|
+
|
|
|
+ [_backgroundPreView.documentView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.equalTo(self.view.mas_left);
|
|
|
+ make.top.equalTo(self.view.mas_top).offset(123.6);
|
|
|
+ make.bottom.equalTo(self.backgroundPreView.mas_bottom).offset(-40);
|
|
|
+ make.width.mas_equalTo(393);
|
|
|
+ }];
|
|
|
+ }
|
|
|
+
|
|
|
+ [_drawBackgroundView setNeedsDisplay];
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark - UIImagePickerControllerDelegate
|
|
|
+
|
|
|
+- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<UIImagePickerControllerInfoKey,id> *)info {
|
|
|
+ UIImage *image = info[UIImagePickerControllerOriginalImage];
|
|
|
+ CGSize size;
|
|
|
+ size.width = self.backgroundPreView.documentView.frame.size.width;
|
|
|
+ size.height = self.backgroundPreView.documentView.frame.size.height;
|
|
|
+// _backgroundPreView.imageView.image = [self imageWithImageSimple:image scaledToSize:size];
|
|
|
+ _dataModel.image = [self imageWithImageSimple:image scaledToSize:_imageSize];
|
|
|
+ [_backgroundPreView.imageView sizeToFit];
|
|
|
+
|
|
|
+ [picker dismissViewControllerAnimated:YES completion:nil];
|
|
|
+ [_drawBackgroundView setNeedsDisplay];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
|
|
|
+ [picker dismissViewControllerAnimated:YES completion:nil];
|
|
|
+}
|
|
|
+
|
|
|
+- (UIImage *)imageWithImageSimple:(UIImage *)image scaledToSize:(CGSize)newSize
|
|
|
+{
|
|
|
+ UIGraphicsBeginImageContext(newSize);
|
|
|
+ [image drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];
|
|
|
+ UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
|
|
|
+ UIGraphicsEndImageContext();
|
|
|
+ return newImage;
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark - UITextFieldDelegate
|
|
|
+
|
|
|
+- (BOOL)textFieldShouldReturn:(UITextField *)textField {
|
|
|
+ [textField resignFirstResponder];
|
|
|
+
|
|
|
+ return YES;
|
|
|
+}
|
|
|
+
|
|
|
+@end
|