CaveOps: Night-City
#Hello Edgerunners, welcome to the Night-City.

Welcome!

iOS 小知识: KVC 与 简单集合运算符

介绍一些 iOS 小知识。 KVC 与简单集合运算 也就是 @sum、@avg、@count、@max、@min 这五个家伙,分别表示和、平均值、计数、最大值,最小值。 举个栗子: NSArray *array = [NSArray arrayWithObjects:@"1.0", @(2.0), @(3.4), @(4.5), @10, nil]; CGFloat sum = [[array valueForKeyPath:@"@sum.doubleValue"] doubleValue]; NSLog(@"sum = %lf",...

iOS 小知识: UITableView 收起键盘

介绍一些 iOS 小知识。 UITableView 收起键盘 可能很多用用过 [self.view endEditing:YES]; 这句代码,但对于 UITableView 还有更好的选择: tableView.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;...

iOS 小知识: URL 脱义

介绍一些 iOS 小知识。 URL 脱义 适用于 URL 中包含中文、其他 URL 或 URL 关键字的情况: NSString *newURL = (NSString *)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,(CFStringRef)<#original_url#>,NULL,NULL,kCFStringEncodingUTF8)); ...

iOS 小知识: 为 UIView 设置图片

介绍一些 iOS 小知识。 给 UIView 设置图片 方法一 UIImage *image = [UIImage imageNamed:@"<#Your Image#>"]; UIColor *color = [UIColor colorWithPatternImage:image]; UIView *view = [[UIView alloc] initWithFrame:<#CGRect#>]; [view setBackGroundColor:color]; 方法二 UIImage *image = [UIImage imageN...

iOS 小知识: 去除 NSString 两端空白与空行

介绍一些 iOS 小知识。 去除 NSString 两端空白与空行" 去除两端空格 [string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; 去除两端换行 [string stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]]; 去除两端空格和换行 [string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewli...

iOS 小知识: 忽略编译器警告

介绍一些 iOS 小知识。 忽略警告 废弃 #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" // 调用废弃方法... #pragma clang diagnostic pop 未使用的值 #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunused-variable" int unused = 0; #pragma cl...

iOS 小知识: 模拟 Home 键点击

介绍一些 iOS 小知识。 模拟 Home 键单击 [[UIApplication sharedApplication] performSelector:@selector(suspend)]; 注意:这是私有 API...

iOS 小知识: 汉字转拼音

介绍一些 iOS 小知识。 汉字转拼音 @interface NSString (MandarinLatin) - (NSString *)stringByReplacingMandarinToLatinWithDiacritics:(BOOL)diacritics firstLetterCapitalizes:(BOOL)capitalizes; @end @implementation NSString (MandarinLatin) - (NSString *)stringByReplacingMandarinToLatinWithDiacritics:(BOOL)diacritics...

iOS 小知识: 生成随机浮点数

介绍一些 iOS 小知识。 生成随机浮点数 定义宏 #define ARC4RANDOM_MAX 0x100000000。 使用 arc4random() 来获取 0 ~ 100 的浮点数了: double val = floorf(((double)arc4random() / ARC4RANDOM_MAX) * 100.0f)...

iOS 小知识: 获取网页内容高度

介绍一些 iOS 小知识。 获取 Web 页面内容高度 利用 JavaScript 来实现,一般写在 UIWebView 代理中。 - (void)webViewDidFinishLoad:(UIWebView *)webView { CGFloat height = [[webView stringByEvaluatingJavaScriptFromString:@"document.body.offsetHeight"] doubleValue]; // ... } ...

iOS 小知识: 防止锁屏

介绍一些 iOS 小知识。 防止锁屏 [[UIApplication sharedApplication] setIdleTimerDisabled:YES];...

iOS apps and the Open Source they use

I've compiled a list of six popular iPhone apps and the iOS Open Source Software they use. I've also linked to the original repositories in case you want to check them out and start contributing to them. Projects that seem inactive, outdated or no longer maintained have been excluded from the list. ...

What's this?

The Night-City version of CaveOps inspired by Cyberpunk 2077. Not finished yet.

Pinned Message

The Founder and CEO of Infeca Technology.

Developer, Designer, Blogger.

Big fan of Apple, Love of colour.

Feel free to contact me.

反曲点科技创始人和首席执行官。

开发、设计与写作皆为所长。

热爱苹果、钟情色彩。

随时恭候 垂询