跳轉UICollectionViewController報Could not load NIB in bundle解決辦法,uicollectionview

來源:互聯網
上載者:User

跳轉UICollectionViewController報Could not load NIB in bundle解決辦法,uicollectionview

      報錯代碼如下:'Could not load NIB in bundle: 'NSBundle </Users/mac/Library/Developer/CoreSimulator/Devices/A0182119-C6AC-4732-BF37-3E6D35B102E1/data/Containers/Bundle/Application/E5F586ED-526F-4D52-9C7C-9335E772F666/00-ItcastLottery.app> (loaded)' with name 'product''

      項目中collectionViewController的自訂cell由xib建立。無奈每次運行都報這個錯,大意是載入不了名字叫“product”的xib檔案。網上搜到的辦法試過都不行。直到第二晚排查才發現原因太簡單,但很容易忽略,如果你不知道,以後可能會在這裡摔跟頭。

      static NSString * const reuseIdentifier = @"product"; 這行是在UICollectionViewController.m檔案用來設定identifier的代碼。問題就在“product”字串這。想不出錯,identifier字串必須和UICollectionViewController控制器載入的自訂cell檔案的檔案名稱一樣。

      MJ課程視頻裡並沒講這點注意事項,自學的童鞋按照以上辦法解決。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.