Note that there are some explanatory texts on larger screens.

plurals
  1. POloadNibNamed - Could not load NIB in bundle: NSBundle
    primarykey
    data
    text
    <p>I'm trying to create a TableViewCell, using a XIB file, but I get this error at execution time:</p> <blockquote> <p>2013-01-10 17:54:50.297 MainApp[6778:b603] <strong>* Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle (loaded)' with name 'DropDownCell'' <br> *</strong> Call stack at first throw:</p> </blockquote> <p>This is what I'm trying to do.<br> I have a project, with a first Menu. In this project/workspace, I have the class for my first Menu. Inside this project, I have another workspace, with the classes for my second Menu. I mean, this workspace is for the SubViewController's and classes for the options selected in my first Menu. In this workspace, I'm trying to create a DropDownMenu,using the demo from apple, but my app crash. This demo creates the cell's in the table, using a XIB file.<br> This is the DropDownCell class:<br> <strong>DropDownCell.h</strong></p> <pre><code>#import &lt;UIKit/UIKit.h&gt; @interface DropDownCell : UITableViewCell{ IBOutlet UILabel *textLabel; IBOutlet UIImageView *arrow_up; IBOutlet UIImageView *arrow_down; BOOL isOpen; } -(void)setOpen; -(void)setClosed; @property (nonatomic)BOOL isOpen; @property (nonatomic,retain) IBOutlet UILabel *textLabel; @property (nonatomic,retain) IBOutlet UIImageView *arrow_up; @property (nonatomic,retain) IBOutlet UIImageView *arrow_down; @end </code></pre> <p><strong>DropDownCell.m</strong> #import "DropDownCell.h"</p> <pre><code>@implementation DropDownCell @synthesize textLabel, arrow_up, arrow_down, isOpen; -(void)setOpen{ [arrow_down setHidden:YES]; [arrow_up setHidden:NO]; [self setIsOpen:YES]; } -(void)setClosed{ [arrow_down setHidden:NO]; [arrow_up setHidden:YES]; [self setIsOpen:NO]; } -(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if(self){ } return self; } -(void)setSelected:(BOOL)selected animated:(BOOL)animated{ [super setSelected:selected animated:animated]; } -(void)dealloc{ [super dealloc]; } @end </code></pre> <p>And the <strong>DropDownCell.xib</strong> has one UITableViewCell with a UILabel.<br> I have another UITableViewController, which uses the DropDownCell XIB. This is the method:</p> <pre><code>-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString *CellIdentifier = @"MenuCell"; static NSString *DropDownCellIdentifier = @"DropDownCell"; if([indexPath row] == 0){ DropDownCell *cell = (DropDownCell*)[tableView dequeueReusableCellWithIdentifier:DropDownCellIdentifier]; if(cell == nil){ NSArray *topLevelObjects = [[NSBundle mainBundle]loadNibNamed:@"DropDownCell" owner:self options:nil]; for(id currentObject in topLevelObjects){ if([currentObject isKindOfClass:[DropDownCell class]]){ cell = (DropDownCell*)currentObject; break; } } } [[cell textLabel] setText:@"Option 1"]; return cell; } </code></pre> <p>But my app crashes when loads the NIB file... What can be the reason? I'm using Xcode 4.3, and I'm not using storyboards.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload