RobotsAndPencils / RPSlidingMenu

A collection view menu in the style of UltraVisual.
MIT License
861 stars 109 forks source link

Use with UIViewController and UICollectionView #32

Open RayanSaeed opened 8 years ago

RayanSaeed commented 8 years ago

Here is my code and the error it gives me, any suggestions?

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        self.collectionView = myCollectionView // It is an IBOutlet 

        featureHeight = 240
        collapsedHeight = 100
    }

UICollectionViewController loadView] instantiated view controller with identifier "ShopViewController" from storyboard "Main", but didn't get a UICollectionView

paulthorsteinson commented 8 years ago

on what line do you get that error?

RayanSaeed commented 8 years ago

In AppDelegate, where I am instantiating ViewControllers programatically.

kysokzla commented 8 years ago

@paulthorsteinson Hey there i got the same issue when i initialize my subclass of RPSlidingMenuViewController. MySubclass is done with XIB, collectionView is connected like in ur Demo, but i get the same issue as @RayanSaeed futhermore i tried many ways of initializing it, and changing outlets connections and so on... Please help

jfosterdavis commented 8 years ago

It appears this occurs when you try to use a UICollectionViewController, the the view outlet isn't connected to a UICollectionView

http://stackoverflow.com/questions/24989741/error-when-set-uicollectionviewcontroller-nib-but-didnt-get-a-uicollectionvie http://stackoverflow.com/a/18284510/6804257

Here is a screenshot where I was getting this same error. My "Photo Tour" is a subclass of UICollectionViewController, which it should not be. I fixed by changing Photo Tour to be a UIViewController and UICollectionViewDelegate, as you can see I also wanted map and button in the same view. screen shot 2016-10-08 at 1 16 52 pm

The app I am working on is still in development, but I just made a commit where I think I have fixed this error in my own project. https://github.com/jfosterdavis/VirtualTourist/commit/599ab9229a9833b0c3291c9d8f693e4ed3a60328