Could not load NIB in bundle with name 'itemCell''

时间:2017-12-18 08:04:41

标签: ios objective-c uitableview

I Can't load uitableviewcell which I took as .xib with tableviewcell class. Please help me out thanks in advance.

import numpy as np

from skimage.transform import hough_line
from scipy import misc

import matplotlib.pyplot as plt
from matplotlib import cm

image = misc.imread("cone.jpg", flatten=True)

# Classic straight-line Hough transform
h, theta, d = hough_line(image)

# Generating figure 1
fig, axes = plt.subplots(1, 3, figsize=(9, 3),
                         subplot_kw={'adjustable': 'box-forced'})
ax = axes.ravel()

ax[0].imshow(image, cmap=cm.gray)
ax[0].set_title('Input image')
ax[0].set_axis_off()

ax[1].imshow(np.log(1 + h),
             extent=[np.rad2deg(theta[-1]), np.rad2deg(theta[0]), d[-1], d[0]],
             cmap=cm.gray, aspect=1/1.5)
ax[1].set_title('Hough transform')
ax[1].set_xlabel('Angles (degrees)')
ax[1].set_ylabel('Distance (pixels)')
ax[1].axis('image')

ax[2].imshow(image, cmap=cm.gray)
for _, angle, dist in zip(*hough_line_peaks(h, theta, d)):
    y0 = (dist - 0 * np.cos(angle)) / np.sin(angle)
    y1 = (dist - image.shape[1] * np.cos(angle)) / np.sin(angle)
    ax[2].plot((0, image.shape[1]), (y0, y1), '-r')
ax[2].set_xlim((0, image.shape[1]))
ax[2].set_ylim((image.shape[0], 0))
ax[2].set_axis_off()
ax[2].set_title('Detected lines')

plt.tight_layout()
plt.show()

3 个答案:

答案 0 :(得分:1)

Add this line in viewDidLoad

Make sure reuse identifier same both place and you should have itemCell.xib in your bundle

 export default {
      data () {
        return {
          tags : 
            [
              {
              topic : "Investor",
              category : [
                {display: "Mutual Fund", value: 'Mutual Fund'},
                {display: "Insurance", value: 'Insurance'},
                {display: "FII", value: 'FII'},
                {display: "PMS", value: 'PMS'},
                {display: "Proprietary", value: 'Proprietary'},
                {display: "HNI", value: 'HNI'},
                {display: "Private Equity", value: 'Private Equity'},
                {display: "Others", value: 'Others'}
              ]
              },
              { 
                topic : "Research",
                category : [
                  {display: "Global", value: 'Global'},
                  {display: "Domestic", value: 'Domestic'},
                  {display: "Retail", value: 'Retail'},
                  {display: "Others", value: 'Others'}
                ]
              },
              { 
                topic : "Corporate" ,
                category : [
                 {display: "Corporate", value: 'Corporate'}
                ]
              },
              {
                topic : "Others", 
                category : [
                  {display: "Debt", value: 'Debt'},
                  {display: "Debt Adviser", value: 'Debt Adviser'},
                  {display: "Investment Banker", value: 'Investment Banker'},
                  {display: "Media", value: 'Media'},
                  {display: "Others", value: 'Others'}
                ]
              }
            ]
         }
      }
    }

答案 1 :(得分:1)

I think you are confused with Cell Identifier and Register nib for Tableviewcell

Register Nib is used to allocate your xib to your cell in

.expect(Selector('img[src="images/icons/bullet_gr.png"]'))

So It is preferred to use this line in ViewDidLoad of your viewController

and CellIdentifier is used identify the type of the cell, as in Table View there can be multiple types of cell, so to identify them, TableView used CellReuseIdentifier

Once you register cell for your table View, You can use the following method

[tableView registerNib:[UINib nibWithNibName:@"HomeRestuTableViewCell" bundle:nil] forCellReuseIdentifier:cellId];

Hope that solves your problem.

答案 2 :(得分:0)

You've used the nib name itemCell, which is probably wrong. Typically you'll name your nib the same as the class which backs it, which means you need to load that named nib, i.e.

<table class="splitTable">
  <tr>
    <td class="sides">
      <div class="leftSide">
        <span class="chooseText">Choose</span>
        <table class="SSRSSObjectCostTableTest" width="25%">
          <tr>
            <td class="sideForSSRSSTables">Say this is 1st element</td>
            <td class="sideForSSRSSTables">Say this is 2nd element</td>
          </tr>
        </table>
      </div>
    </td>

    <td class="sides">
      <div class="rightSide">
        <span class="partsText">Parts</span>
        <button type="button" class="addButton">+Add Part</button>

        <!--<table class="outerPartTable">-->

        <table class="partsTable">
          <td class="sideForPartsTable" width="5%">Expand button</td>
          <td class="sideForPartsTable">Title + sum1 + sum2</td>
          <td class="sideForPartsTable" width="5%">edit</td>
          <td class="sideForPartsTable" width="5%">remove</td>

        </table>
        <!--</table>-->
      </div>
    </td>

  </tr>
</table>

There's no requirement that you name nibs the same as the class, so check what the filename is for your nib, but if it's [tableView registerNib:[UINib nibWithNibName:@"HomeRestuTableViewCell" bundle:nil] forCellReuseIdentifier:cellId]; , and it's in your main bundle, the above registration should fix the error for you.

相关问题