У меня есть UICollectionView внутри всплывающего окна, которое является простым представлением в файле xib. В то же xibfile у меня UICollectionViewCell так:UICollectionView не отображает ячейки в пользовательском popupview
The View подключен к классу SampleViewController и UICollectionViewCell подключен к классу PekProfil
код я использую для отображения ячеек является
[_collectionView registerClass:[PekProfil class] forCellWithReuseIdentifier:@"vinnare"];
_collectionView.delegate = self;
_collectionView.dataSource = self;
и:
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"vinnare";
PekProfil * cellen = (PekProfil *)[collectionView dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath];
cellen.backgroundColor = [UIColor grayColor];
if (cellen==nil) {
cellen = [[PekProfil alloc] init];
}
NSString * iden = [_winners objectAtIndex:indexPath.row];
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:iden
parameters:nil
HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
NSLog(@"fetched friends:%@", result);
cellen.pekProfilNamn.text = [result objectForKey:@"name"];
NSString * ideno = [NSString stringWithFormat:@"https://graph.facebook.com/%@/picture?width=640&height=640", iden];
NSLog(@"IDEN:%@", ideno);
NSString *pictureUrl = ideno;
NSURL * url = [NSURL URLWithString:pictureUrl];
NSLog(@"PICURL:%@", pictureUrl);
NSData *data = [NSData dataWithContentsOfURL:url];
NSLog(@"%@", data);
UIImage *img = [[UIImage alloc] initWithData:data];
//roundpic
CALayer *imageLayer = cellen.profilePicView.layer;
[imageLayer setCornerRadius:5];
[imageLayer setBorderWidth:1];
[imageLayer setMasksToBounds:YES];
[cellen.profilePicView.layer setCornerRadius:cellen.profilePicView.frame.size.width/2];
[cellen.profilePicView.layer setMasksToBounds:YES];
//END
cellen.profilePicView.image = img;
}];
return cellen;
}
И я знаю, что facebookcode работает, поскольку я использую тот же код в других местах.
Однако работает это отображается только это:
Любые идеи, почему содержание не отображается?
Спасибо большое! Это отлично сработало, просто изменило все и создало новый класс с xibfile и зарегистрировало Nib вместо класса. –