내 프로젝트에서 고유 한 설정 번들 (UIBundle이라고 함)을 만들고 xib 파일 중 일부를 드래그했습니다.xib 파일을 자체 번들에 저장하지 못했습니다.
: 그럼 예를 들어, 번들이 테이블 뷰 셀 XIB를로드하기 위해 노력하고있어 : 다음과 같은 메시지와 함께 세포를로드 할 때- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"MyCell";
MyCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
NSArray *nib = [[self xibsBundle] loadNibNamed:@"MyCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
}
return cell;
}
- (NSBundle *) xibsBundle
{
NSString *path = [[NSBundle mainBundle] pathForResource:@"UIBundle" ofType:@"bundle"];
return [NSBundle bundleWithPath:path];
}
하지만 내 응용 프로그램을 실행할 때마다, 그것은 충돌
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </var/containers/Bundle/Application/.../App.app/UIBundle.bundle> (not yet loaded)' with name 'MyCell''
하루를 보내고 성공을 거두지 못한 솔루션을 찾았습니다. 어떤 도움을 주시면 감사하겠습니다.
P. 번들이 성공적으로로드되고 xib 파일 외의 다른 모든 리소스에 액세스 할 수 있습니다.
아마도이 질문은 도움이 될 수 있습니까? http://stackoverflow.com/questions/9904615/how-to-create-multiple-bundles-in-iphone-application 번들이 검색되고 다른 콘텐츠에 액세스 할 수 있습니까? – Lepidopteron
@Lepidopteron 안녕하세요. xib 파일 이외의 다른 리소스에 액세스 할 수 있습니다. –
번들에 라이브러리로 이런 방식으로 리소스를 추가하려면이 방법을 시도해 보셨습니까? http://www.galloway.me.uk/tutorials/ios-library-with-resources/ – Lepidopteron