Latest 0.2.9
Homepage https://github.com/poos/SXHelper
License MIT
Platforms ios 7.1, requires ARC
Dependencies AFNetworking
Authors

任何问题欢迎留言
或者发邮箱[email protected]

BaseViewController

//创建上导航左侧按钮(以view作模板)

  • (void)createNavigationLeftButton:(id)view;
    //文字按钮 ←— 左侧
  • (void)createNavigationBarLeftBarButtonItemWithTitle:(NSString *)title;
  • (void)createNavigationBarLeftBarButtonItemWithTitle:(NSString *)title style:(UIBarButtonItemStyle)style;
  • (void)createNavigationBarLeftBarButtonItemWithTitle:(NSString *)title style:(UIBarButtonItemStyle)style target:(id)target action:(SEL)action;

//创建上导航右侧按钮(以view作模板)

  • (void)createNavigationRightButton:(id)view;
    //文字按钮 —→ 右侧
  • (void)createNavigationBarRightBarButtonItemWithTitle:(NSString *)title;
  • (void)createNavigationBarRightBarButtonItemWithTitle:(NSString *)title style:(UIBarButtonItemStyle)style;
  • (void)createNavigationBarRightBarButtonItemWithTitle:(NSString *)title style:(UIBarButtonItemStyle)style target:(id)target action:(SEL)action;

//有键盘-设置Yes会调整view
@property (nonatomic,assign) BOOL isKeyboard;//默认No

  • (void)onKeyboardNotification:(NSNotification *)notification;

DButton : UIButton

//init

  • (instancetype)createFullScreenButtonClickBlock:(ClickBlock)clickBlock;
  • (instancetype)createClearButtonFrame:(CGRect)rect andClickBlock:(ClickBlock)clickBlock;

  • (instancetype)initWithFrame:(CGRect)rect title:(NSString *)title font:(CGFloat)font;
  • (instancetype)initWithFrame:(CGRect)rect title:(NSString *)title titleRect:(CGRect)titRect font:(CGFloat)font;
  • (instancetype)initWithFrame:(CGRect)rect imageName:(NSString *)imgName imageRect:(CGRect)imgRect;
  • (instancetype)initWithFrame:(CGRect)rect imageName:(NSString )imgName imageRect:(CGRect)imgRect title:(NSString )str titleRect:(CGRect)titRect titleFont:(CGFloat)font;

    Factory : NSObject

//创建Label的工厂,将特殊的元素传入,生产相对应的Label

  • (UILabel )createLabelWithTitle:(NSString )title frame:(CGRect)frame;
  • (UILabel )createLabelWithTitle:(NSString )title frame:(CGRect)frame textColor:(UIColor *)color fontSize:(CGFloat)size;

//创建textField的工厂,将特殊的元素传入,生产响应的textField

  • (UITextField )createTextFieldWithFrame:(CGRect)frame placeholder:(NSString )placeholder;
  • (UITextField )createTextFieldWithFrame:(CGRect)frame text:(NSString )text placeholder:(NSString )placeholder textColor:(UIColor )color borderStyle:(UITextBorderStyle)borderStyle;

//创建UIView的工厂,将特殊的元素传入,生产响应的UIView

  • (UIView )createViewWithFrame:(CGRect)frame backColor:(UIColor )color;

LoginUserInfo : NSObject

@property (nonatomic, strong) NSString userName; // 用户名
@property (nonatomic, strong) NSString
userPhone; // 用户名
@property (nonatomic, strong) NSString passWord; // 密码
@property (nonatomic, strong) NSString
memberAccessToken; // 用户Token
@property (nonatomic, strong) NSString *joinkey; // 账号邀请码

@property (nonatomic, strong) NSArray recrentCityArray; // 最近城市
@property (nonatomic, strong) NSString
locationCity; // 定位城市
@property (nonatomic, assign) double longitude; // 经度
@property (nonatomic, assign) double latitude; // 纬度

@property (nonatomic, assign) BOOL isFirstRun; // 是否是第一次运行程序
@property (nonatomic, assign) BOOL isAutoLogin; // 是否自动登录
@property (nonatomic, assign) BOOL isGeTui; // 判断个推是否开启(未用到)
@property (nonatomic, assign) BOOL isWifi; // 储存网络状态
@property (nonatomic, assign) BOOL isOpenImage; // 是否打开显示图片

@property (nonatomic, strong) NSDictionary *otherInfo; // 其他参数

NetRequest : NSObject

//Get
//无缓存

  • (void)startGetWithUrl:(NSString )urlStr andParameters:(NSDictionary )paramDic whenSuccess:(Success)success andFailure:(Failure)failure;
    //带缓存
  • (void)startGetWithCacheUrl:(NSString )urlStr andParameters:(NSDictionary )paramDic whenSuccess:(Success)success andFailure:(Failure)failure;

//Post

  • (void)startPostWithUrl:(NSString )urlStr andParameters:(NSDictionary )paramDic whenSuccess:(Success)success andFailure:(Failure)failure;
    //Delete
  • (void)startDeleteWithUrl:(NSString )urlStr andParameters:(NSDictionary )paramDic whenSuccess:(Success)success andFailure:(Failure)failure;
    // PUT
  • (void)startPutWithUrl:(NSString )urlStr andParameters:(NSDictionary )paramDic whenSuccess:(Success)

NSString (Helper)

//给一个字体大小判断显示的宽度

  • (CGFloat)widthWithFont:(CGFloat)font;

//生成一个uuid

  • (NSString *)getUUIDString;

//获取字符串中的中文字符串

  • (NSString )getStringChinese:(NSString )text;

//获取合法字符串(汉字和字符)

  • (NSString )getStringChineseAndCharacter:(NSString )text;

//16.3.31,过滤html标签

  • (NSString )flattenHTML:(NSString )html;

//中文字符串排序
//NSComparator comparator;

@end

@interface NSAttributedString (Helper)

//创建带颜色的属性字符串

  • (NSMutableAttributedString )createAttributedStringTotalStr:(NSString )totalStr andPartStr:(NSString )partStr andPartStrColor:(UIColor )partColor;

TableViewHandle : NSObject <UITableViewDelegate,UITableViewDataSource>

//初始化

  • (id)initWithItems:(NSArray )items
    cellClassName:(NSString
    )cellClassName
    configureCellBlock:(TableViewCellConfigureBlock)configureCellBlock
    cellHeightBlock:(CellHeightBlock)heightBlock
    didSelectBlock:(DidSelectCellBlock)didselectBlock;
    //设置代理
  • (void)handleTableViewDatasourceAndDelegate:(UITableView *)table;

//重设dataSouth,!!!–>没有reload

  • (void)resetDataArr:(NSArray *)dataArr;

UIImage (Helper)

// 高斯模糊

  • (UIImage )sx_blurredImageWithRadius:(CGFloat)radius
    iterations:(NSUInteger)iterations
    tintColor:(UIColor
    )tintColor;

//默认模糊

  • (UIImage *)sx_blurredImageDefault;

//从颜色转1像素的图片

  • (UIImage )imageWithColor:(UIColor )color;

//从存储直接加载图片

  • (UIImage )createUIImageWithResource:(NSString )resource andType:(NSString *)type;

UINavigationController (UpDown)

  • (void)pushUpContorller:(UIViewController *)controller;
  • (void)popDownController;

  • (void)pushController:(UIViewController *)controller;
  • (void)popController;

UIView (Action)

//展示一个提醒弹窗

  • (void)showAlert:(NSString *)str;
  • (void)showAlertTitle:(NSString )title message:(NSString )message alertStyle:(UIAlertControllerStyle)style cancleTitle:(NSString )cancleTitle otherButton:(NSArray <NSString >*)otherButtonTitles sure:(void(^)(NSInteger index))sureBlcok;

//向上找到第一个controller

  • (UIViewController *)viewController;

//设置星星

  • (void)setStarFromValue:(float)value;
  • (void)setScaleStarFromValue:(float)value;

//view 旋转

  • (void)viewRotation180;

//15.9.29新增,view抖动

  • (void)viewShake;

////16.8.9 view弹出
//- (void)viewCurveEaseInOut;

UIView (Addition)

//取得view宽/高

  • (CGFloat)width;
  • (CGFloat)height;
    //取得view的上/下/左/右偏移
  • (CGFloat)top;
  • (CGFloat)bottom;
  • (CGFloat)left;
  • (CGFloat)right;
    //取得view的中心x/y坐标
  • (CGFloat)centerX;
  • (CGFloat)centerY;
    //设置view居中
  • (void)setCenter:(CGPoint)point;

//设置宽/高/x/y

  • (void)setWidth:(CGFloat)width;
  • (void)setHeight:(CGFloat)height;
  • (void)setXOffset:(CGFloat)x;
  • (void)setYOffset:(CGFloat)y;

//设置原点在父视图的偏移

  • (void)setOrigin:(CGPoint)origin;

//设置视图的尺寸

  • (void)setSize:(CGSize)size;

Latest podspec

{
    "name": "SXHelper",
    "version": "0.2.9",
    "summary": "you can use the helper easy coding",
    "homepage": "https://github.com/poos/SXHelper",
    "license": "MIT",
    "authors": {
        "xiaoR": "[email protected]"
    },
    "platforms": {
        "ios": "7.1"
    },
    "source": {
        "git": "https://github.com/poos/SXHelper.git",
        "tag": "0.2.9"
    },
    "source_files": "Example/SXHelper/SXHelper/SXHelper.h",
    "requires_arc": true,
    "dependencies": {
        "AFNetworking": [
            "~> 3.1.0"
        ]
    },
    "subspecs": [
        {
            "name": "MainClass",
            "source_files": "Example/SXHelper/SXHelper/**/*.{h,m}",
            "public_header_files": "Example/SXHelper/SXHelper/**/*.h",
            "dependencies": {
                "AFNetworking": [
                    "~> 3.1.0"
                ]
            }
        }
    ]
}

Pin It on Pinterest

Share This