关于几个容易出错的地方

第一个:

当push出一个collectionView的时候会崩溃,原因是没有布局什么的  看不太懂英文,解决方案

重写init方法  在你需要push出来的界面

-(id)init{

    UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc]init];

    if (self =[super initWithwithCollectionViewLayout:layout]) {

        

    }

    return self;

}

 第二个:

关于用Storyboard和代码联合一起往另一个collectionView传值时会出现随机数  为了固定这个数 

解决方案

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {

    if ([segue.identifier isEqualToString:@"gotoEssayDetail"]) {

        //取出对象

        ThreeOneCollectionViewController *VC = segue.destinationViewController;

 

        NSIndexPath *indexPath=self.collectionV.indexPathsForSelectedItems[0];

        Three33OneItemOfBannersModel *ThreeModel = _dataSource [indexPath.row];

        //赋值

       VC.numb = ThreeModel.target_id;

 

    }

}

 

posted @ 2016-07-03 18:12  堇此丶一生  阅读(115)  评论(0编辑  收藏  举报