UICollectionView registerClass 에서 작동하지 않는 UIViewController(사진,코드,&log)
-
21-12-2019 - |
문제
가 프로그램으로 원하는 화면 분할 두 가지 섹션으로(UISplitViewController 여기에 적용되지 않기 때문에 이미 가지고 있습니다 uinavigationcontroller 가로 rootMenuController.
문제할 수 없는 내 jquery 과 또는 내 UICollectionView 사용 registerClass
방법입니다.에 대한 jquery 과 그것이 문제가 아니지만,그것은 필요한 UICollectionView.내가 실행 시뮬레이터는 어떤 표시하는 것 같으로 UICollectionView 연결이 끊어졌습니다.
나는 무엇을 잘못하고 있는 곳에 그것을 기록하지 않는 클래스를 위한 셀룰라 다시 사용자 id>
#import "SELMenuViewController.h"
@interface SELMenuViewController () <UITableViewDataSource, UITableViewDelegate, UICollectionViewDataSource, UICollectionViewDelegate>
@property (weak, nonatomic) IBOutlet UIButton *backButton;
@property (weak, nonatomic) IBOutlet UIButton *paymentButton;
@end
@implementation SELMenuViewController
- (IBAction)employeeSelect:(id)sender {
[self.navigationController popViewControllerAnimated:YES];
self.navigationController.navigationBarHidden = NO;
}
- (IBAction)paymentScreen:(id)sender {
NSLog(@"payment screen");
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection: (NSInteger)section {
return 1;
}
-(UICollectionViewCell*)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"menuCell" forIndexPath:indexPath];
cell.backgroundColor = [UIColor redColor];
return cell;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 1;
}
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [[UITableViewCell alloc] init];
cell.textLabel.text = @"text";
return cell;
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
self.itemsOrdered = [[UITableView alloc] init];
self.menuItems = [[UICollectionView alloc] initWithFrame:self.view.frame collectionViewLayout:[[UICollectionViewFlowLayout alloc] init]];
[self.menuItems registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"menuCell"];
}
return self;
}
여기에 오류 로그의...
2014-07-29 18:52:40.302OlymPOS[2267:60b] *주장에서 실패-[UICollectionView_dequeueReusableViewOfKind:withIdentifier:forIndexPath:viewCategory:],/SourceCache/UIKit_Sim/UIKit-2935.137/UICollectionView.m:3241 2014-07-29 18:52:40.306OlymPOS[2267:60b]* 종료되는 인을 포착되지 않는 예외'NSInternalInconsistencyException',원인:지에서 보기의 종류:UICollectionElementKindCell 식별자를 가진 menuCell-등록해야 합 펜촉하거나 클래스에 대한 식별자 또는 연결을 시제품에서 셀보' ***첫 번째 던져 호출 스택:( 0CoreFoundation0x00000001019a5495 exceptionPreprocess+165 1 을 간단하게 수정하는 것이 가능.니다.dylib0x000000010170499e objc_exception_throw+43 2CoreFoundation0x00000001019a531a+[NSException 인상:서식:인수:]+106 3Foundation0x00000001012a0f19-[NSAssertionHandler handleFailureInMethod:object file:줄 번호:description:]+189 4UIKit0x000000010083e2b7-[UICollectionView_dequeueReusableViewOfKind:withIdentifier:forIndexPath:viewCategory:]+1324 5OlymPOS0x0000000100013efe-[SELMenuViewController collectionView:cellForItemAtIndexPath:]+110 6UIKit0x0000000100831cae-[UICollectionView_createPreparedCellForItemAtIndexpath:withLayoutAttributes:applyAttributes:]+264 7UIKit0x000000010083330b-[UICollectionView_updateVisibleCellsNow:]+3581 8UIKit0x0000000100836ae1-[UICollectionView layoutSubviews]+243 9UIKit0x0000000100311993-[UIView(CALayerDelegate)layoutSublayersOfLayer:]+354 10QuartzCore0x0000000104475802-[CALayer layoutSublayers]+151 11QuartzCore0x000000010446a369_ZN2CA5Layer16layout_if_neededEPns_11transactione+363 12QuartzCore0x000000010446a1ea_ZN2CA5Layer28layout_and_display_if_neededepns_11transactione+24 13QuartzCore0x00000001043ddfb8_ZN2CA7Context18commit_transactionepns_11transactione+252 14QuartzCore0x00000001043df030_ZN2CA11Transaction6commitEv+394 15QuartzCore0x00000001043df69d_ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv+89 16CoreFoundation0x0000000101970dc7__CFRUNLOOP_이_호출_OUT_TO_이_관_콜백_기능 +23 17CoreFoundation0x0000000101970d37__CFRunLoopDoObservers+391 18CoreFoundation0x0000000101950522__CFRunLoopRun+946 19CoreFoundation0x000000010194fd83CFRunLoopRunSpecific+467 20GraphicsServices0x0000000104002f04GSEventRunModal+161 21UIKit0x00000001002b1e33UIApplicationMain+1010 22OlymPOS0x000000010000f663 메인+115 23libdyld.dylib0x00000001025235fd 시작+1 24???0x0000000000000001 0x0+1 ) 템의 기능을 지원합니다.abi.dylib:종료와 함께 포착되지 않는 형식의 예외가 NSException (런타임 라이브러리가 들어)
해결책
컬렉션을 만들 보기에 init,등록하고 클래스 올바로 설정하여(아마도)아웃렛도 있습니다.
그런 다음 보기는,로드하는 일 나중 보다 init,그리고 이것을 만들 것입 또 다른 컬렉션 보기 및 할당을 아울렛도 있습니다.이 컬렉션을 볼 수 없었는 클래스를 등록,그래서 그것은 실패합니다.
그 이유는 분명하지 않을 귀찮게 만드는 컬렉션을 볼 수 있으면 중 하나에 당신의 를지 않는 한 그것은 절망적인 해결 방법입니다.
옳은 일을 하는 등록에서 클래스 viewDidLoad
, 는 포인트 컬렉션에서 보기 펜촉이 존재합니다.