PLVVodMediaFdUtil

Objective-C

@interface PLVVodMediaFdUtil : NSObject

Swift

class PLVVodMediaFdUtil : NSObject

Foundation 通用工具类

Dic&ArrayUtil

  • 检查字典是否可用 (YES-可用;NO-不可用;‘可用’代表不为空、NSDictionary类型、count大于0)

    Declaration

    Objective-C

    + (BOOL)checkDictionaryUseable:(NSDictionary *)dict;

    Swift

    class func checkDictionaryUseable(_ dict: [AnyHashable : Any]!) -> Bool
  • 检查数组是否可用 (YES-可用;NO-不可用;‘可用’代表不为空、NSArray类型、count大于0)

    Declaration

    Objective-C

    + (BOOL)checkArrayUseable:(NSArray *)array;

    Swift

    class func checkArrayUseable(_ array: [Any]!) -> Bool

StringUtil

  • 字符串的URL编码

    Declaration

    Objective-C

    + (NSString *)URLEncodedString:(NSString *)url;

    Swift

    class func urlEncodedString(_ url: String!) -> String!
  • 将 url 链接封装上 https 协议头

    Declaration

    Objective-C

    + (NSString *)packageURLStringWithHTTPS:(NSString *)urlString;

    Swift

    class func packageURLString(withHTTPS urlString: String!) -> String!
  • 检查字符串是否可用 (YES-可用;NO-不可用;‘可用’代表不为空、NSString类型、length大于0)

    Declaration

    Objective-C

    + (BOOL)checkStringUseable:(NSString *)string;

    Swift

    class func checkStringUseable(_ string: String!) -> Bool
  • url string 安全的 percent-encoding,防止已 percent-encoding 的字符串二次编码

    Declaration

    Objective-C

    + (NSString *)stringBySafeAddingPercentEncoding:(NSString *)urlStr;

    Swift

    class func string(bySafeAddingPercentEncoding urlStr: String!) -> String!
  • Undocumented

    Declaration

    Objective-C

    + (NSString *)cutSting:(NSString *)string WithCharacterLength:(NSInteger)length;

    Swift

    class func cutSting(_ string: String!, withCharacterLength length: Int) -> String!

UILabel Util

  • 寻找UILabel中对应的点所在位置字体属性

    Declaration

    Objective-C

    + (NSDictionary *)textAttributesAtPoint:(CGPoint)point withLabel:(id)label;

    Swift

    class func textAttributes(at point: CGPoint, withLabel label: Any!) -> [AnyHashable : Any]!

ImageUtil

  • Undocumented

    Declaration

    Objective-C

    + (void)setImageWithURL:(NSURL *)url inImageView:(UIImageView *)imageView completed:(void(^)(UIImage *image, NSError *error, NSURL *imageURL))completedBlock;

    Swift

    class func setImageWith(_ url: URL!, inImageView imageView: Any!, completed completedBlock: ((UnsafeMutablePointer<Int32>?, Error?, URL?) -> Void)!)

DateUtil

  • Undocumented

    Declaration

    Objective-C

    + (long long)curTimeInterval;

    Swift

    class func curTimeInterval() -> Int64
  • 获取当前时间的13位毫秒时间戳

    Declaration

    Objective-C

    + (NSString *)curTimeStamp;

    Swift

    class func curTimeStamp() -> String!

    Return Value

    long long 适配4s 32位机型

  • 秒时间转字符串

    Declaration

    Objective-C

    + (NSString *)secondsToString:(NSTimeInterval)seconds;

    Swift

    class func seconds(toString seconds: TimeInterval) -> String!
  • 秒时间转字符串(固定格式) 格式 00:00:00

    Declaration

    Objective-C

    + (NSString *)secondsToString2:(NSTimeInterval)seconds;

    Swift

    class func seconds(toString2 seconds: TimeInterval) -> String!
  • 字符串转时间

    Declaration

    Objective-C

    + (NSTimeInterval)secondsToTimeInterval:(NSString *)timeString;

    Swift

    class func seconds(toTimeInterval timeString: String!) -> TimeInterval

HudUtil

  • HUD 提示

    Declaration

    Objective-C

    + (void)showHUDWithTitle:(nullable NSString *)title
                      detail:(nullable NSString *)detail
                        view:(id)view;

    Swift

    class func showHUD(withTitle title: String?, detail: String?, view: Any!)

Common

  • Undocumented

    Declaration

    Objective-C

    + (UIViewController * _Nonnull)getCurrentViewController;

    Swift

    class func getCurrentViewController() -> Any!
  • 获取UIApplication里面第一个UIWindow对象

    Declaration

    Objective-C

    + (id)getFirstUIWindowFormUIApplication;

    Swift

    class func getFirstUIWindowFormUIApplication() -> Any!

Device

  • Undocumented

    Declaration

    Objective-C

    + (BOOL)isiPhoneXSeries;

    Swift

    class func isiPhoneXSeries() -> Bool
  • 将屏幕转至竖屏

    Declaration

    Objective-C

    + (void)changeDeviceOrientationToPortrait;

    Swift

    class func changeDeviceOrientationToPortrait()
  • 将屏幕旋转至相应方向

    Declaration

    Objective-C

    + (void)changeDeviceOrientation:(id)orientation;

    Swift

    class func changeDeviceOrientation(_ orientation: Any!)
  • 获取设备型号名

    Note

    示例:iPhone XS

    Declaration

    Objective-C

    + (NSString *_Nullable)getiPhoneTypeName;

    Swift

    class func getiPhoneTypeName() -> String?