Is there anyway to do it?
I've tried pathForResource:ofType:
on NSBundle and it can't find the xib when it's really there. If I try to load it and it doesn't exist loadNibNamed:owner:options:
crashes and so does nibWithNibName:bundle:
Basically, I want to know at runtime whether I should register a xib or just a class for a given cell type on a collection view.
Are you sure pathForResource:ofType:
is not working? It's not just the common xib / nib confusion?
(.xib-files are ofType:@"nib"
)...
NSBundle *mainBundle = [NSBundle mainBundle];
NSString *path = [mainBundle pathForResource:@"crapXib" ofType:@"nib"]; // file is called crapXib.xib
if (path){
// whatever...
} else{
// whatever else
}