澎湃iPad上线版本

toolKit.h 5.2KB

    // // toolKit.h // ThePaperDemo // // Created by Scar on 14-9-4. // Copyright (c) 2014年 scar1900. All rights reserved. // #import <Foundation/Foundation.h> //用于UIImage的imageNamed函数载入resource.bundle下的图片 extern NSString* Bundle(NSString* fileName); //根据图片路径加载图片 extern UIImage* Image(NSString* imageName); //弹出消息框来显示消息 extern void ShowMessage(NSString* message,BOOL isSuccess); extern void ShowTextMessage(NSString* message); extern void ShowTextMessageInPop(NSString* message,UIView* popView); extern void ShowTextMessageWithDelay(NSString* message,NSInteger delayTime); extern void showStatusText(NSString *text); //状态栏显示 extern void showStatusTextNotDismiss(NSString *text); void ShowTextMessageInPop(NSString* message,UIView* popView); extern UIFont* appFont(CGFloat size,BOOL isBold); extern NSString* getImageNameFromURL(NSString*url); extern NSString* getImageNumFromURL(NSString*url); extern NSString* fileNameFromUrl(NSString* url); //毛玻璃效果快照 extern UIImageView* customBlurSnapshotFromView(UIView *inputView); extern UIImageView* customDarkBlurSnapshotFromView(UIView *inputView); extern UIImageView* customLightDarkBlurSnapshotFromView(UIView *inputView); //普通快照 extern UIImage* getSnapshotImgFromView(UIView*inputView); //返回纯色图片 extern UIImage* imageWithUIColor(UIColor *color); //文件存放路径快捷方法 extern NSString* CachePath(NSString* fileName); //cache extern NSString* ConfigPath(NSString* fileName); //Document extern NSString* tempPath(NSString* fileName);//temp extern NSString* ResourcePath(NSString* fileName); //检查是否存在相关路径及文件 extern BOOL ExistAtPath(NSString* fileFullPath); extern float rectScale (); extern BOOL AddSkipBackupAttributeToItemAtURLFile(NSURL* URL); //将字典转为对应数据模型 extern id setJsonDicToDataModel(NSDictionary *dic, Class dataClass); //将数据模型转为字典 extern id setDataModelToDic(id dataModel, Class dataClass); //将网络数据转为数据库数据 extern id makeRemoteModelToCoreDataModel(id remoteModel,Class remoteDataClass,NSManagedObject *coreDataModel); //将数据库转为网络数据 extern id makeCoreDataModelToRemoteModel(id CoreDataModel,Class remoteDataClass); //将数据库数据转为字典 extern NSDictionary* makeCoreDataModelToDic(id CoreDataModel,Class coreDataClass); //将字典转为相应数据库数据 extern id makeDicToCoreDataModel(NSDictionary*dic, NSManagedObject* coreDataModel); //动态计算label高度和宽度 extern float heightForString(NSString *str, UIFont* font, float width,NSLineBreakMode mode); extern float heightForAttributeString(NSAttributedString *str, CGFloat width,UIFont *font); extern float heightForAttributeStringWithLabel(NSAttributedString *str, CGFloat width,UIFont *font); extern float widthForString(NSString *str, UIFont* font, float height,NSLineBreakMode mode); extern CGFloat returnTextHeightWithRTLabel(NSString*text, CGFloat width, UIFont* font,CGFloat lineSpace); extern CGFloat returnTextWidthWithRTLabel(NSString*text, CGFloat height, UIFont* font,CGFloat lineSpace); extern NSAttributedString* attributedStringWithHtml(NSString* html); extern NSAttributedString* getLineSpaceAttributedString(NSString* string, CGFloat lineSpace, UIFont* font); //时间相关 extern NSString* StringFromDate(NSDate* aDate, NSString *aFormat); extern NSDate* DateFromString(NSString* string, NSString* aFormat); extern NSString* getUpdateStringFromDate(NSDate* date); extern NSDate* getLocalDate(); //将文章加入已读存储 extern void addHaveReadFlag(NSString* contId); //设置左侧抽屉是否需要手势 extern void needGestureOfSideController(BOOL isNeed); //检查字符串是否为空 extern BOOL isBlankString(NSString *string); extern void SaveFile(NSString* fileName, NSData* data); extern NSString *getForwardTypeWithTypeInPush(remotePushBO* push); extern void pushContentWithListContentObject(UINavigationController *naviController,listContObjectVO *listItem); extern void pushContentWithCommentBO(UINavigationController *naviController,commentObjectVO *commentBO); extern void pushContentWithObjInfo(UINavigationController *naviController,objInfoBO *commentBO); extern void pushTopicPageWithTopicInfo(UINavigationController *naviController,TopicInfoBO *topicInfo); extern void pushLetterPageWithLetterBO(UINavigationController *naviController,letterBO *letterBo); extern void presentAfterPushOrClickAd(); extern void popToFrontPage(); extern NSString *returnNumOfVersion(NSString *versionStr); extern BOOL isNeedUpdate(NSString *latestVerstion,NSString *currentVersion,NSString* ignoreVersion); extern void pushToContentAfterPushOrClickAd(UINavigationController *naviController); //清理内存图片缓存 extern void clearImageMemCache (); extern NSString* deviceString(); extern BOOL isContainsEmoji(NSString *string); extern NSString * disable_emoji(NSString *text); extern NSString *setStrSpaceForParagraphSpacingWithString(NSString *str); commentObjectVO * setStrSpaceForParagraphSpacingWithCommentBO(commentObjectVO *commentBO); extern NSMutableArray * analysisContent(NSArray* list); extern CGFloat getLineHeightWithCountAndFontWidth(int count,CGFloat lineSpace,CGFloat fontSize);