This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// 获取 url 的顶级域名. 比如, a.example.com 的顶级域名是 example.com | |
- (NSString *)topLevelDomainNameFromUrl:(NSURL *)url { | |
if (url.absoluteString.length == 0) { | |
return nil; | |
} | |
NSString *topLevelDomainName = @""; | |
NSString *host = url.host; | |
NSArray *subStrings = [host componentsSeparatedByString:@"."]; | |
NSUInteger count = subStrings.count; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// 参考 WeexSDK `WXConvert.m` 中的 `+UIColor:` 方法 (且在其基础上添加了对 #rrggbbaa 格式的支持) | |
/// @param colorString 颜色字符串, 支持以下格式: | |
/// #fff | |
/// #rrggbb | |
/// #rrggbbaa | |
/// rgb(r,g,b) | |
/// rgba(r,g,b,a) | |
+ (UIColor *)colorWithColorString:(NSString *)colorString { | |
// 1. check cache | |
static NSCache *colorCache; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// `dispatch_once' singleton initialisation | |
+ (id)sharedInstance { | |
static EOCClass *sharedInstance = nil; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
sharedInstance = [[self alloc] init]; | |
}); | |
return sharedInstance; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UIViewController *)topViewController{ | |
return [self topViewController:[UIApplication sharedApplication].keyWindow.rootViewController]; | |
} | |
- (UIViewController *)topViewController:(UIViewController *)rootViewController | |
{ | |
if (rootViewController.presentedViewController == nil) { | |
return rootViewController; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// YTKAnimatingRequestAccessory.h | |
// Ape_uni | |
// | |
// Created by Chenyu Lan on 10/30/14. | |
// Copyright (c) 2014 Fenbi. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
#import <YTKBaseRequest.h> |