Я разрабатываю свое первое приложение для iPad с Xcode 5.1 на iOS 7.0 и использую UICollectionView
.
Мой CollectionViewController включается в представление моего исходного контроллера, когда я нажимаю первую вкладку на панели навигации.
Ячейки исчезают через несколько секунд или когда я нажимаю где-нибудь на экране.
Если я поставлю CollectionViewController в качестве начального контроллера представления, с ячейками все в порядке!
Я не понимаю! Нужна помощь, пожалуйста.
#import "ActiviteViewController.h"
#import "AppDelegate.h"
#import "Embarcation.h"
#import "CollectionActiviteCellController.h"
@interface ActiviteViewController ()
@end
@implementation ActiviteViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self; }
- (void) viewWillAppear: (BOOL) animated {
[super viewWillAppear:animated];
[[self view] setFrame: CGRectMake(0, 0, 1024, 618)]; }
-(BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds {
return YES; }
- (void)viewDidLoad {
[super viewDidLoad];
AppDelegate* appDelegate = [UIApplication sharedApplication].delegate;
// Fetching Records and saving it in "fetchedRecordsArray" object
self.embarcationsArray = [appDelegate getAllPayments];
[self.collectionView reloadData]; }
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated. }
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
// Return the number of sections.
return 1; }
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
// Return the number of rows in the section.
return [self.embarcationsArray count]; }
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
CollectionActiviteCellController *myCell = [collectionView dequeueReusableCellWithReuseIdentifier:@"MonEmbarcation"
forIndexPath:indexPath];
Embarcation * embarcation = [self.embarcationsArray objectAtIndex:indexPath.row];
myCell.labelEmbarcation.text = [NSString stringWithFormat:@"%@, %@ ",embarcation.nom,embarcation.etat];
NSLog([NSString stringWithFormat:@"%@, %@ ",embarcation.nom,embarcation.etat]);
return myCell; }
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a
little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller. }
*/
@end