工程常用功能封装
来源:互联网 发布:linux sleep函数头文件 编辑:程序博客网 时间:2024/05/16 09:49
常用的插件 ,
代码提示 https://github.com/FuzzyAutocomplete/FuzzyAutocompletePlugin
变量高亮显示 https://github.com/keepyounger/HighlightSelectedString
APP中常用的宏,类别
#define Screen_Weidth [UIScreen mainScreen].bounds.size.width#define Screen_Heigth [UIScreen mainScreen].bounds.size.height/** * rgb颜色转换 参数 0x0085fe */#define UIColorFrom16RGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]/** * 添加圆角 * * @param __sender 加圆角的view * @param __radius 弧度 */#define AddCornerRadius(__sender,__radius) __sender.layer.cornerRadius = __radius;\__sender.clipsToBounds = YES;\__sender.layer.borderWidth = .5;\__sender.layer.borderColor = [UIColor clearColor].CGColor;
#define WeakSelf __weak typeof(self) weakSelf = self ;
swift加圆角
func addCorner(corner:CGFloat , width : CGFloat = 0.5 , color:UIColor = UIColor.clear) { self.layer.borderColor = color.cgColor self.layer.borderWidth = width self.layer.cornerRadius = corner self.clipsToBounds = true }}
就是写了类别,来覆盖原来方法.
.h 文件
#import <Foundation/Foundation.h>
@interface NSArray (log)
@end
@interface NSDictionary (Log)
@end
/**
* uiview 设置frame
*/
@interface UIView (Layout)
@property (assign,nonatomic)CGFloat x;
@property (assign,nonatomic)CGFloat y;
@property (assign,nonatomic)CGPoint origin;
@property (assign,nonatomic)CGFloat centerX;
@property (assign,nonatomic)CGFloat centerY;
@property (assign,nonatomic)CGFloat width;
@property (assign,nonatomic)CGFloat height;
@property (assign,nonatomic)CGSize size;
@end
.m 文件
#import "NSArray+log.h"
@implementation NSArray (log)
- (NSString *)descriptionWithLocale:(id)locale{
NSMutableString * string = [[NSMutableString alloc]init];
[string appendString:@"[\n"];
for (int i = 0; i < self.count; i++) {
[string appendFormat:@"\t%d -- %@,\n",i,self[i]];
}
[string stringByAppendingString:@"]\n"];
return string;
}
@end
@implementation NSDictionary (Log)
- (NSString *)descriptionWithLocale:(id)locale
{
NSMutableString *strM = [NSMutableString stringWithString:@"{\n"];
[self enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
[strM appendFormat:@"\t%@ = %@;\n", key, obj];
}];
[strM appendString:@"}\n"];
return strM;
}
@end
/**
* uiview frame 设置
*/
@implementation UIView (Layout)
@dynamic width;
@dynamic height;
@dynamic size;
@dynamic x;
@dynamic y;
- (CGFloat)x
{
returnself.frame.origin.x;
}
- (void)setX:(CGFloat)value
{
CGRect frame =self.frame;
frame.origin.x = value;
self.frame = frame;
}
- (CGFloat)y
{
returnself.frame.origin.y;
}
- (void)setY:(CGFloat)value
{
CGRect frame =self.frame;
frame.origin.y = value;
self.frame = frame;
}
- (CGPoint)origin
{
returnself.frame.origin;
}
- (void)setOrigin:(CGPoint)origin
{
CGRect frame =self.frame;
frame.origin = origin;
self.frame = frame;
}
- (CGFloat)centerX
{
returnself.center.x;
}
- (void)setCenterX:(CGFloat)centerX
{
CGPoint center =self.center;
center.x = centerX;
self.center = center;
}
- (CGFloat)centerY
{
returnself.center.y;
}
- (void)setCenterY:(CGFloat)centerY
{
CGPoint center =self.center;
center.y = centerY;
self.center = center;
}
- (CGFloat)width
{
returnself.frame.size.width;
}
- (void)setWidth:(CGFloat)width
{
CGRect frame =self.frame;
frame.size.width = width;
self.frame = frame;
}
- (CGFloat)height
{
returnself.frame.size.height;
}
- (void)setHeight:(CGFloat)height
{
CGRect frame =self.frame;
frame.size.height = height;
self.frame = frame;
}
- (CGSize)size
{
returnself.frame.size;
}
- (void)setSize:(CGSize)size
{
CGRect frame =self.frame;
frame.size = size;
self.frame = frame;
}
@end
- 工程常用功能封装
- string 常用功能封装
- javascrip常用功能封装框架
- 【PHP】php ipv4常用功能封装
- PHP GD库常用功能封装
- 在JSP中用bean封装常用的功能
- 在JSP中用bean封装常用的功能
- 在JSP中用bean封装常用的功能
- 两个做项目最常用功能操作的封装类
- 做项目最常用功能操作的封装类 (转载)
- 在JSP中用bean封装数据库常用的功能
- VSPackge插件系列:常用IDE功能的封装
- Appium——驱动和常用功能的封装
- Appium——驱动和常用功能的封装
- 常用封装
- MFC SQlite3封装工程
- iOS开发工具类,包含常用功能,为方便使用,特为常用功能封装并且使用宏定义方式运用
- ios 开发超实用技巧:Xcode里批量修改 || 工程名 || 变量名 || 修改类名 || 自动封装代码Refactor功能
- JAVA多线程实现的三种方式
- java遍历一个目录中不包括当前目录的其他所有父级目录
- PostgreSQL教程
- 前端第三方接口调用
- 两种获取view的bitmap的方法
- 工程常用功能封装
- MVC初见二
- viewpager防止fragment销毁和以及取消fragment的预加载(平常开发时不怎么考虑这个问题)
- map/reduce
- java的动态代理机制
- oracle 显示unix timestamp 自定义函数
- 隐马尔科夫模型(Hidden Markov Model,HMM)
- 读书的时间哪里来?
- 建议30:使用LINQ取代集合中的比较器和迭代器