2015年3月11日 星期三

[Xcode] 警告: Detected a case where constraints ambiguously suggest a height of zero for a tableview cell’s content view.

在使用UITableView時,如果有自訂儲存格的高度,要記得另外要設定好rowHeight屬性喔!不然會碰到警告訊息:

Warning once only: Detected a case where constraints ambiguously suggest a height of zero for a tableview cell’s content view. We’re considering the collapse unintentional and using standard height instead.

我這次是載入自訂的儲存格XIB,也有另外設定了rowHeight,忘了妥善處理,所以收到了這個警告,處理的方法很簡單~只要加上這兩個方法~在紅字的地方填上你要的儲存格高度(CGFloat),即可:
func tableView(tableView: UITableView, estimatedHeightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
        return 你要的儲存格高度
    }
    
    func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
        return 你要的儲存格高度
    }

又或者更簡便的方法是直接在viewDidLoad中加上下述程式碼,即可:
self.tableView.rowHeight = 36.0

參考資料:[Stack Overflow] iOS8 - constraints ambiguously suggest a height of zero: link

2015年3月2日 星期一

[Xcode] 錯誤:logging directory does not exist

今天在裝置上運行相本相關的程式時,出現了

[PLLogging] ***** Error: logging directory does not exist /var/mobile/Library/Logs/CrashReporter/DiagnosticLogs/

的錯誤訊息,雖然看起來似乎是對程式沒有什麼影響,但是同樣的程式已經運行了好幾次了,今天是第一次出現這樣的訊息,而且是在我重新插拔裝置之後發生的,所以還是有點在意。

搜尋了一下,發現似乎是Xcode的Bug,只要將裝置重新啟動,就可以解決囉!大家如果有碰到這個錯誤訊息,就不用太緊張喔~!

相關文章:
  • Stack Overflow:link