集合视图变为空

时间:2014-09-17 07:28:21

标签: ios objective-c ipad uicollectionview swrevealviewcontroller

我正在开发一个应用程序,我有一个集合视图(父视图)和一个SWReveal稳定视图。当我在表视图中选择一行并关闭Swreveal视图控制器时。在父视图中,除集合视图外,所有数据都可用。集合视图变为空。 这是我的代码

父view.h

#import <UIKit/UIKit.h>
#import "MyNotificationsViewController.h"

#import "NotesandReminders.h"
#import "Cell.h"
#import "SWRevealViewController.h"

@interface TimeTableViewController : UIViewController <UICollectionViewDataSource, UICollectionViewDelegate,MJSecondPopupDelegate,UIAlertViewDelegate>
{
 UIPopoverController *popoverController;
  //  IBOutlet UICollectionView *collectionData;

}

@property (nonatomic, retain) IBOutlet UICollectionView *collectionData;

父视图.m

-(void)TestMethod
{


    NSLog(@"taggg %d ",tag);
   NSLog(@"indexxx %@",indexPathsss);
    NSLog(@"eht collection data %@",collectionData);

   // [self ChangeCells];
}


SwREvel view controller .h


#import <UIKit/UIKit.h>
#import "LearningSearchCell.h"
#import "TimeTableViewController.h"
#import "AppDelegate.h"

@interface LearningSearchController : UIViewController<UITableViewDataSource,UITableViewDelegate>

@property(strong,nonatomic)TimeTableViewController *TimeObj;

@property(nonatomic,assign)AppDelegate *AppObj;

@end

SwReveal view controller.M

-(void)viewWillDisappear:(BOOL)animated
{
    _TimeObj=[TimeTableViewController alloc];


    [_TimeObj TestMethod];

//from here i call the Test method of parent view controller... i am getting all values except the collection view becomes null

}

我甚至尝试过创建属性并对其进行sysnthesized ..它仍为null

1 个答案:

答案 0 :(得分:0)

您未在此UIViewController的@implementation中添加viewWillDissapear。这使您无需使用对象即可初始化代码。