标志 | 值 | 含义 |
---|---|---|
NULL | (void *)0 | C指针的字面零值 |
nil | (id)0 | Objective-C对象的字面零值 |
Nil | (Class)0 | Objective-C类的字面零值 |
NSNull | [NSNull null] | 用来表示零值的单独的对象 |
This file contains 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
// override : layoutSubviews | |
- (void)layoutSubviews | |
{ | |
[super layoutSubviews]; | |
self.backgroundColor = [UIColor clearColor]; | |
for (UIView *subview in self.subviews) { |
This file contains 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
//iOS7 | |
#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame) | |
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending) | |
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending) | |
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending) |
This file contains 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
import Foundation | |
fileprivate let tabBarItemTag: Int = 10090 | |
extension UITabBar { | |
public func addItemBadge(atIndex index: Int) { | |
guard let itemCount = self.items?.count, itemCount > 0 else { | |
return |
This file contains 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
#!/usr/bin/swift | |
import Foundation | |
func backup() { | |
let args = CommandLine.arguments | |
guard args.count > 1 else { | |
return print("Backup Failed! : \n Detail: Missing commit message whick should be surrounded by quotation mark.") | |
} | |
let arg = args[1] |