//
// UIKit+Category.h
// ActionLabel
//
// Created by Sean on 14-3-14.
// Copyright (c) 2014年 Sean. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#pragma mark UIColor (16进制Color)
/**
16进制的color初始化,比如UIColorFrom16RGB(0xDDEEFF)
*/
#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]
#pragma mark UILabel (UnderLineLabel)
@interface UILabel (UnderLineLabel)
/**
设置带下划线的文本
@node 需要在设置text后使用该方法
*/
- (void) setUnderlineTextRange:(NSRange) range;
@end
#pragma mark UILabel (AutoFitLayout)
@interface UILabel(AutoFitLayout)
/**
根据指定的Font和位置Origin及宽度,自动调整文本的高度。
@node 需要在设置text后使用该方法
*/
- (void) autoFitLayout;
@end
#pragma mark UILabel (ActionLabel)
@interface UILabel (ActionLabel)
/**
给整个label增加点击方法,链接颜色为textColor,高亮颜色为highlightTextColor
@node 需要在设置text后使用该方法,如果highlightTextColor没有指定,则默认为grayColor
@param target 相应的target,不能为nil
@param action action方法,最多可带一个参数
*/
- (void) addTarget:(id)target action:(SEL)action;
@end
#pragma mark UILabel (ColorLabel)
@interface UILabel (ColorLabel)
/**
为label的部分设置特定颜色
@node 需要在设置text后使用该方法
@param color 指定的颜色
@param range 指定的范围,该范围不能超出label文本的总长度
*/
- (void) setColor:(UIColor*) color
withRange:(NSRange) range;
@end
#pragma mark UILabel (ParagraphStyle)
@interface UILabel (ParagraphStyle)
/**
设置完属性,需要调用 -applyParagraphStyle 应用
*/
- (void) applyParagraphStyle;
/**
设置文本行间距
*/
- (void) setLineSpace:(CGFloat) lineSpace;
/**
调整行距,使用lineHeightMultiple更改行距倍数.
*/
- (void) setLineHeightMultiple:(CGFloat) lineHeightMultiple;
/**
设置文本对齐模式
*/
- (void) setTextAlignment:(NSTextAlignment) alignment;
/**
设置首行缩进的距离(像素)。不能为负值
*/
- (void) setFirstLineHeadIndent:(CGFloat) firstLineHeadIndent;
/**
调整全部文字的缩排距离,可当作左边 padding 使用
*/
- (void) setHeadIndent:(CGFloat) headIndent;
/**
调整文字尾端的缩排距离。需要注意的是,这里指定的值可以当作文字显示的宽(正值),
而也可当作右边padding(负值)使用,依据输入的正负值而定.
*/
- (void) setTailIndent:(CGFloat) tailIndent;
/**
针对不同的字型与字号,可以透过指定最大(maximumLineHeight)与
最小行距(minimumLineHeight)来避免过高或过窄的状况发生。
*/
- (void) setMaximumLineHeight:(CGFloat) maximumLineHeight;
- (void) setMinimumLineHeight:(CGFloat) minimumLineHeight;
/**
指定段落结尾距离
*/
- (void) setParagraphSpace:(CGFloat) paragraphSpace;
/**
段落开头距离(像素值)
*/
- (void) setParagraphSpacingBefore:(CGFloat) paragraphSpacingBefore;
@end
#pragma mark UIView (Addition)
@interface UIView (Addition)
/**
设定Origin的Y值,不改变Size
*/
@property (nonatomic) CGFloat top;
/**
设置底部,相应会改变Origin的Y值,不改变Size
*/
@property (nonatomic) CGFloat bottom;
/**
设定Origin的X值,不改变Size
*/
@property (nonatomic) CGFloat left;
/**
设定右边,相应会设定Origin的X值,不改变Size
*/
@property (nonatomic) CGFloat right;
/**
改变Size,不改变Origin
*/
@property (nonatomic) CGFloat width;
/**
改变Size,不改变Origin
*/
@property (nonatomic) CGFloat height;
/**
获取view的快照
*/
- (UIImage *)snapshotImage;
@end
/*!
UIView的层级
@details 引入这一概念后,所有的view再起superView中得层次关系会
基于level的大小。默认的level=0
*/
#pragma mark UIView (ViewLevel)
@interface UIView (ViewLevel)
/** 每个view的level */
@property (nonatomic, readonly) NSInteger level;
/**
以给定的level添加view.
@details 对于某个view来说,它的level值越高,那么其在supview的层级
结构中越处于顶部(level=2的View会盖住level=1的View)。
调用 addSubview: 默认level=0
@param view 要添加的view,不能为nil
@param level 指定的层级,如果传入的为负值,会置level=0.
*/
- (void) addSubview:(UIView *)view
atLevel:(NSInteger) level;
@end
#pragma mark UIView (ViewController)
@interface UIView (ViewController)
/**
获取view所在的viewController
*/
- (UIViewController *)viewController;
/**
获取view所在的navigationController
*/
- (UINavigationController *)navigationController;
/**
获取view所在的tabBarController
*/
- (UITabBarController *)tabBarController;
@end
#pragma mark UIViewController (PushPop)
@interface UIViewController (PushPop)
/** push 方法
@param viewController 要push的viewController,不能为nil
@param animated 是否需要动画
*/
- (void)pushViewController:(UIViewController *)viewController
animated:(BOOL)animated;
/** pop 方法
@param animated 是否需要动画
*/
- (UIViewController *)popViewControllerAnimated:(BOOL)animated;
@end
#pragma mark UITableViewCell (ShortCut)
@interface UITableViewCell (ShortCut)
/*!
* @brief 获取cell所在的tableView
*/
@property(nonatomic,readonly) UITableView *tableView;
/*!
* @brief 获取cell在tableView的位置
*/
@property(nonatomic,readonly) NSIndexPath *indexPath;
@end
#pragma mark UIDevice (Platform)
@interface UIDevice (Platform)
/** 获取手机硬件的platform,比如(iPhone1,2)等 */
+ (NSString *)platform;
/** 获取手机硬件的platformType,比如:iphone4S,ipad5等 */
+ (NSString *)platformType;
/** 获取手机硬件的platformDesctiption,比如:iPadMiniRetina(WiFi+CDMA)等 */
+ (NSString *)platformDesctiption;
/**
判断当前手机操作系统的version是否低与给定的值
@param systemVersion指定的值,比如"4.0"
*/
+ (BOOL)isCurrentSystemVersionLowerThan:(NSString*)systemVersion;
@end
#pragma mark UIDevice (DiskSpace)
@interface UIDevice (DiskSpace)
/** 磁盘空间总大小 */
+ (NSNumber *) diskTotleSpace;
/** 磁盘使用大小 */
+ (NSNumber *) diskUsedSpace;
/** 磁盘剩余 */
+ (NSNumber *) diskFreeSpace;
/** 计算文件大小,比如20K,398M,43G等 */
+ (NSString*) fileSizeWithNumber:(NSNumber*) number;
+ (NSString*) fileSizeWithDouble:(double) value;
@end
#pragma mark UIApplation (DirectoryPath)
@interface UIApplication (DirectoryPath)
/** 获取app在沙盒的Library文件夹地址 */
+ (NSString*) pathForLibraryDirectory;
/** 获取app在沙盒的Document文件夹地址 */
+ (NSString*) pathForDocumentDirectory;
@end
#pragma mark UIApplation (RemoteNotifination)
@interface UIApplication (RemoteNotifination)
/**
判断App是否打开了推送开关
*/
+ (BOOL) isAPPEnabledRemoteNotification;
@end
#pragma mark UIScreen (ShortCut)
@interface UIScreen (ShortCut)
/**
整个屏幕的宽
@details 这个API得到的是整个屏幕的尺寸
*/
+ (CGFloat) mainScreenWidth;
/**
整个屏幕的高
@details 这个API得到的是整个屏幕的尺寸
*/
+ (CGFloat) mainScreenHeight;
/**
应用展示屏幕的宽
@details 应用窗口实际的宽。如果导航条隐藏,那么
返回值与 mainScreenWidth 相同
*/
+ (CGFloat) applicationScreenWidth;
/**
应用展示屏幕的高
@details 应用窗口实际的高。如果导航条隐藏,那么
返回值与 mainScreenHeight 相同
*/
+ (CGFloat) applicationScreenHeight;
@end
没有合适的资源?快使用搜索试试~ 我知道了~
UIKit+Foundation比较实用的category方法
共9个文件
h:5个
plist:1个
ds_store:1个
3星 · 超过75%的资源 需积分: 10 13 下载量 173 浏览量
2014-03-28
12:57:01
上传
评论 1
收藏 127KB ZIP 举报
温馨提示
1、整理UILabel、UIDevice、UIApplation、UIImage、UIImageView、UIView等UI相关的 category。 A、UILabel支持自定义布局类型,支持下划线,支持点击,支持任意设置颜色等 B、UIView添加设置位置的快捷操作方法 C、UIDevice可以快速获取硬件型号、磁盘可用空间等属性 D、UIApplation常用存储路径的快速访问 E、UIImage的快速初始化和UIImageView的点击事件等 F、16进制颜色的初始化 2、整理NSString、NSDictionary、NSData等常用数据结构的快捷定制方法 说明:使用方法同系统framework,支持IOS6以上的系统,不支持ARC
资源推荐
资源详情
资源评论
收起资源包目录
Category.framework.zip (9个子文件)
Category.framework
.DS_Store 6KB
Headers
UIImageView+Category.h 1KB
Foundation+Category.h 5KB
UIKit+Category.h 8KB
UIImage+Category.h 2KB
Category.h 352B
Info.plist 1KB
Category 368KB
en.lproj
InfoPlist.strings 42B
共 9 条
- 1
资源评论
- z1762622512015-07-23然而并没有什么卵用!
- RENXIAOHAO2015-07-24挺实用的呀
- 岁瑞冬吉2015-06-03哥们儿,你居然封成framework,简直是醉了,有没封成静态库的么?给我发一份呗,QQ:714700382
at_2012
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功