singleton.h
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface Singleton : NSObject
+ (void)showAlertWithTitle:(NSString *)title message:(NSString *)msg controller:(id)controller;
+ (void)setShadow:(UITextField*)controller;
+ (void)setShadowView:(UIView*)controller;
+ (void)setCornerHomeCell:(UIView*)controller;
+ (void)setShadowHomeCell:(UIView*)controller;
@end
singleton.m
#import "Singleton.h"
@implementation Singleton
+ (void)showAlertWithTitle:(NSString *)title message:(NSString *)msg controller:(id)controller
{
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:msg preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:nil];
[alertController addAction:okAction];
[controller presentViewController:alertController animated:YES completion:nil];
}
+ (void)setCornerHomeCell:(UIView*)controller
{
controller.layer.cornerRadius = 7;
controller.layer.masksToBounds = true;
}
+ (void)setShadowHomeCell:(UIView*)controller
{
controller.layer.cornerRadius = 7;
controller.layer.shadowColor = [UIColor blackColor].CGColor;
controller.layer.shadowOffset = CGSizeMake(0.0f, 0.0f);
controller.layer.shadowOpacity = 0.15f;
}
+ (void)setShadow:(UITextField*)controller
{
// controller.layer.shadowColor = [UIColor blackColor].CGColor;
// controller.layer.shadowOffset = CGSizeMake(1.0f, 1.0f);
// controller.layer.shadowOpacity = 0.15f;
Singleton *s = [[Singleton alloc]init];
controller.layer.cornerRadius = 5;
controller.layer.shadowColor = [UIColor blackColor].CGColor;
controller.layer.borderColor = [s colorFromHexString:@"#EAE9E9"].CGColor; //[UIColor lightGrayColor].CGColor;
controller.layer.borderWidth = 0.8;
controller.layer.shadowOffset = CGSizeMake(0.0f, 0.0f);
controller.layer.shadowOpacity = 0.05f;
}
+ (void)setShadowView:(UIView*)controller
{
Singleton *s = [[Singleton alloc]init];
controller.layer.cornerRadius = 5;
controller.layer.shadowColor = [UIColor blackColor].CGColor;
controller.layer.borderColor = [s colorFromHexString:@"#EAE9E9"].CGColor; //[UIColor lightGrayColor].CGColor;
controller.layer.borderWidth = 0.8;
controller.layer.shadowOffset = CGSizeMake(0.0f, 0.0f);
controller.layer.shadowOpacity = 0.05f;
}
- (UIColor *)colorFromHexString:(NSString *)hexString
{
unsigned rgbValue = 0;
NSScanner *scanner = [NSScanner scannerWithString:hexString];
[scanner setScanLocation:1]; // bypass '#' character
[scanner scanHexInt:&rgbValue];
return [UIColor colorWithRed:((rgbValue & 0xFF0000) >> 16)/255.0 green:((rgbValue & 0xFF00) >> 8)/255.0 blue:(rgbValue & 0xFF)/255.0 alpha:1.0];
}
@end
Sign up here with your email
ConversionConversion EmoticonEmoticon