feat:set UIRectEdgeNone for iOS
This commit is contained in:
@@ -37,4 +37,6 @@ NSBundle *_Nonnull DoricBundle(void);
|
||||
#define DC_UNLOCK(lock) dispatch_semaphore_signal(lock);
|
||||
#endif
|
||||
|
||||
void showToast(NSString *_Nonnull text, DoricGravity gravity);
|
||||
void ShowToast(NSString *_Nonnull text, DoricGravity gravity);
|
||||
|
||||
UIImage *_Nonnull UIImageWithColor(UIColor *color);
|
@@ -48,7 +48,7 @@ void DoricLog(NSString *_Nonnull format, ...) {
|
||||
}
|
||||
|
||||
|
||||
void showToast(NSString *text, DoricGravity gravity) {
|
||||
void ShowToast(NSString *text, DoricGravity gravity) {
|
||||
UIView *superView = [UIApplication sharedApplication].windows.lastObject;
|
||||
UILabel *label = [[UILabel alloc] init];
|
||||
label.font = [UIFont systemFontOfSize:20.f];
|
||||
@@ -74,4 +74,15 @@ void showToast(NSString *text, DoricGravity gravity) {
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t) (2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
[label removeFromSuperview];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
UIImage *UIImageWithColor(UIColor *color) {
|
||||
CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
|
||||
UIGraphicsBeginImageContext(rect.size);
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
CGContextSetFillColorWithColor(context, [color CGColor]);
|
||||
CGContextFillRect(context, rect);
|
||||
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
|
||||
UIGraphicsEndImageContext();
|
||||
return image;
|
||||
}
|
||||
|
Reference in New Issue
Block a user