ViewController.m 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. //
  2. // ViewController.m
  3. // OJAKitDemo
  4. //
  5. // Created by luxiaoming on 16/7/4.
  6. // Copyright © 2016年 luxiaoming. All rights reserved.
  7. //
  8. #import "ViewController.h"
  9. #import <Foundation/Foundation.h>
  10. #import "OJAKit.h"
  11. #import "UIImage+YYWebImage.h"
  12. @interface ViewController ()
  13. @end
  14. @implementation ViewController
  15. - (void)viewDidLoad {
  16. [super viewDidLoad];
  17. // Do any additional setup after loading the view, typically from a nib.
  18. CGFloat width = CGRectGetWidth([UIScreen mainScreen].bounds);
  19. CGFloat height = CGRectGetHeight([UIScreen mainScreen].bounds);
  20. // UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, width, 300)];
  21. // imageView.backgroundColor = [UIColor orangeColor];
  22. // imageView.image = testImage;
  23. // imageView.contentMode = UIViewContentModeScaleToFill;
  24. UIImage *originImage = [UIImage imageNamed:@"Jennifer Lynn Connelly.jpg"];//510*288 1x
  25. UIImage *testImage = [UIImage imageNamed:@"Jennifer Lynn Connelly.jpg"];//510*288 1x
  26. // testImage = [testImage oja_imageByResizeToSize:CGSizeMake(200, 400)];
  27. // testImage = [testImage oja_imageByResizeToSize:CGSizeMake(200, 400) contentMode:UIViewContentModeScaleToFill];
  28. // testImage = [testImage oja_imageByCropToRect:CGRectMake(0, 0, 800, 400)];
  29. // testImage = [testImage oja_imageByInsetEdge:UIEdgeInsetsMake(-10, -150, -10, -150) withColor:[UIColor redColor]];
  30. // testImage = [testImage oja_imageByInsetEdge:UIEdgeInsetsMake(10, 150, 10, 150) withColor:[UIColor redColor]];
  31. // testImage = [testImage oja_imageByRoundCornerRadius:100 corners:UIRectCornerTopLeft borderWidth:5 borderColor:[UIColor redColor] borderLineJoin:kCGLineJoinMiter];
  32. // testImage = [testImage yy_imageByRoundCornerRadius:10 corners:UIRectCornerTopLeft borderWidth:5 borderColor:[UIColor redColor] borderLineJoin:kCGLineJoinMiter];
  33. originImage = [originImage oja_imageByRotate:45 / 180.0 * M_PI fitSize:YES];
  34. testImage = [testImage yy_imageByRotate:45 / 180.0 * M_PI fitSize:YES];
  35. // testImage = [testImage oja_imageByRotate:45 / 180.0 * M_PI fitSize:NO];
  36. // testImage = [testImage yy_imageByTintColor:[UIColor redColor]];
  37. // testImage = [testImage yy_imageByBlurWithTint:[UIColor redColor]];
  38. // testImage = [testImage yy_imageByBlurLight];
  39. // testImage = [testImage yy_imageByGrayscale];
  40. UIImageView *imageView = [[UIImageView alloc] initWithImage:testImage];
  41. imageView.frame = CGRectMake(0, 0, 320, 280);
  42. imageView.backgroundColor = [UIColor orangeColor];
  43. imageView.contentMode = UIViewContentModeScaleAspectFit;
  44. [self.view addSubview:imageView];
  45. UIImageView *originImageView = [[UIImageView alloc] initWithImage:originImage];
  46. originImageView.frame = CGRectMake(0, 288, 320, 280);
  47. originImageView.backgroundColor = [UIColor orangeColor];
  48. originImageView.contentMode = UIViewContentModeScaleAspectFit;
  49. [self.view addSubview:originImageView];
  50. [originImageView setAllCornerRadius:10];
  51. }
  52. - (void)didReceiveMemoryWarning {
  53. [super didReceiveMemoryWarning];
  54. // Dispose of any resources that can be recreated.
  55. }
  56. @end