Various Fixes

This commit is contained in:
Ilya Laktyushin
2021-07-26 03:55:08 +03:00
parent e4f09f39fd
commit df7a68ea73
7 changed files with 131 additions and 11 deletions

View File

@@ -14,6 +14,51 @@
#import "TGMediaPickerPhotoCounterButton.h"
#import "TGMediaPickerPhotoStripView.h"
@implementation TGCameraCornersView
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self != nil) {
self.contentMode = UIViewContentModeScaleToFill;
static UIImage *cornersImage = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^
{
CGSize size = CGSizeMake(50.0, 50.0);
UIGraphicsBeginImageContextWithOptions(CGSizeMake(50.0, 50.0), false, 0.0f);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetAlpha(context, 0.5);
CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor);
CGContextSetBlendMode(context, kCGBlendModeCopy);
CGFloat width = 1.0;
CGFloat length = 24.0;
CGContextFillRect(context, CGRectMake(0, 0, length, width));
CGContextFillRect(context, CGRectMake(0, 0, width, length));
CGContextFillRect(context, CGRectMake(size.width - length, 0, length, width));
CGContextFillRect(context, CGRectMake(size.width - width, 0, width, length));
CGContextFillRect(context, CGRectMake(0, size.height - width, length, width));
CGContextFillRect(context, CGRectMake(0, size.height - length, width, length));
CGContextFillRect(context, CGRectMake(size.width - length, size.height - width, length, width));
CGContextFillRect(context, CGRectMake(size.width - width, size.height - length, width, length));
cornersImage = [UIGraphicsGetImageFromCurrentImageContext() stretchableImageWithLeftCapWidth:25 topCapHeight:25];
UIGraphicsEndImageContext();
});
self.image = cornersImage;
self.userInteractionEnabled = false;
}
return self;
}
@end
@interface TGCameraMainView ()
{