@import url(http://www.shnenglu.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
Unknown class in Interface Builder file
解決Xcode中swift語言查找符號Symbol not found的問題。更換工程的SDK為7.1或者其他版本,應該是SDK8.0的bug
swift使用數組+=錯誤:Array<AnyObject>! is not identical to 'UInt8'
The += operator on arrays only concatenates arrays, it does not append an element. This resolves ambiguity working with Any, AnyObject and related types.
UIView不支持深拷貝,先壓縮之后在解壓,通過獲取解壓的版本來得到新的副本
UIView *newView = [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:oldView]];
UITableView設置grounped特性之后,頂部空白了一段區域,解決辦法:
Unknown class in Interface Builder file
Check your nibs or storyboard, and make sure none of your views are set to the class!
swift中的注釋說明:
TODO: + 說明:
如果代碼中有該標識,說明在標識處有功能代碼待編寫,待實現的功能在說明中會簡略說明。比如 //TODO:加入登陸功能.
FIXME: + 說明:
如果代碼中有該標識,說明標識處代碼需要修正,甚至代碼是錯誤的,不能工作,需要修復,如何修正會在說明中簡略說明。
XXX: + 說明:
如果代碼中有該標識,說明標識處代碼雖然實現了功能,但是實現的方法有待商榷,希望將來能改進,要改進的地方會在說明中簡略說明。
關于UIView的autoresizingMask屬性的研究
在 UIView 中有一個autoresizingMask的屬性,它對應的是一個枚舉的值(如下),屬性的意思就是自動調整子控件與父控件中間的位置,寬高。
1
2
3
4
5
6
7
8
9
|
enum { UIViewAutoresizingNone = 0, UIViewAutoresizingFlexibleLeftMargin = 1 << 0, UIViewAutoresizingFlexibleWidth = 1 << 1, UIViewAutoresizingFlexibleRightMargin = 1 << 2, UIViewAutoresizingFlexibleTopMargin = 1 << 3, UIViewAutoresizingFlexibleHeight = 1 << 4, UIViewAutoresizingFlexibleBottomMargin = 1 << 5 }; |
UIViewAutoresizingNone就是不自動調整。
UIViewAutoresizingFlexibleLeftMargin 自動調整與superView左邊的距離,保證與superView右邊的距離不變。
UIViewAutoresizingFlexibleRightMargin 自動調整與superView的右邊距離,保證與superView左邊的距離不變。
UIViewAutoresizingFlexibleTopMargin 自動調整與superView頂部的距離,保證與superView底部的距離不變。
UIViewAutoresizingFlexibleBottomMargin 自動調整與superView底部的距離,也就是說,與superView頂部的距離不變。
UIViewAutoresizingFlexibleWidth 自動調整自己的寬度,保證與superView左邊和右邊的距離不變。
UIViewAutoresizingFlexibleHeight 自動調整自己的高度,保證與superView頂部和底部的距離不變。
UIViewAutoresizingFlexibleLeftMargin |UIViewAutoresizingFlexibleRightMargin 自動調整與superView左邊的距離,保證與左邊的距離和右邊的距離和原來距左邊和右邊的距離的比例不變。比如原來距離為20,30,調整后的距離應為68,102,即68/20=102/30。
其它的組合類似。
解決Xcode中swift語言查找符號Symbol not found的問題。更換工程的SDK為7.1或者其他版本,應該是SDK8.0的bug
swift使用數組+=錯誤:Array<AnyObject>! is not identical to 'UInt8'
The += operator on arrays only concatenates arrays, it does not append an element. This resolves ambiguity working with Any, AnyObject and related types.
UIView不支持深拷貝,先壓縮之后在解壓,通過獲取解壓的版本來得到新的副本
UIView *newView = [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:oldView]];
UITableView設置grounped特性之后,頂部空白了一段區域,解決辦法:
tableView.sectionHeaderHeight = 0
tableView.sectionFooterHeight = 0
tableView.rowHeight = 0
object-c 將NSString轉換為json 字典.tableView.sectionFooterHeight = 0
tableView.rowHeight = 0
NSString *data; //一個json格式的字符串
NSDictionary *json =
[NSJSONSerialization JSONObjectWithData: [data dataUsingEncoding:NSUTF8StringEncoding]
options: NSJSONReadingMutableContainers
error: &error];
NSDictionary *json =
[NSJSONSerialization JSONObjectWithData: [data dataUsingEncoding:NSUTF8StringEncoding]
options: NSJSONReadingMutableContainers
error: &error];