drawRect / Instagram_Stories

Inspired by Instagram Stories functionality. This source is similar to Instagram Stories, which is having both image and video support.
MIT License
414 stars 76 forks source link

How do I integrate the stories collection as a part of my viewcontroller (with storyboard) file? #132

Open ghost opened 2 years ago

ghost commented 2 years ago

Dear Ranjith,

I was very impressed with your project Instagram Stories which you published here on github. I am working on an app which includes a user profile and one of the user profile features will be stories like on instagram, exactly as you build it yourself :)

I am a new developer and still work with a Storyboard on my project. How do I integrate the stories collection as a part of my viewcontroller file?

I tried so many ways(!!) to work around with your project but failed every time. I am desperate now :/ stories

Please see the attached print screen which will demonstrate what I am looking to achieve.

Best Regards, Ido

ranmyfriend commented 2 years ago

Hi @TheSlider32

Thanks for creating an issue :)

Actually, we have created IGHomeController for this root setup. And this controller has collection view only, What am saying here is you can 1)reuse this view controller for yourself, or create one container view add to try to 2)add this IGHomeController as child-view controller to your own VC. If you are still now able to achieve it, and which way you are following it. please feel free to reply back to this comment step by step. We will help you to fix it.

ghost commented 2 years ago

finally !! Thank you very much it works !!

ghost commented 2 years ago

When I reuse IGHomeController inside container view the clear cache button doesn't appear. But when I started your project alone it does shows the clear cache button. How can I activate the clear cache button inside the container view?

Best Regards, Ido.

ranmyfriend commented 2 years ago

Hi @TheSlider32 We have added clear cache button in the NavigationItem of IGHomeController.

check the following code

override var navigationItem: UINavigationItem {
        let navigationItem = UINavigationItem()
        navigationItem.titleView = UIImageView(image: UIImage(named: "icInstaLogo"))
        if isClearCacheEnabled {
            navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Clear Cache", style: .done, target: self, action: #selector(clearImageCache))
            navigationItem.rightBarButtonItem?.tintColor = UIColor(red: 203.0/255, green: 69.0/255, blue: 168.0/255, alpha: 1.0)
        }
        navigationItem.rightBarButtonItem?.tintColor = UIColor(red: 203.0/255, green: 69.0/255, blue: 168.0/255, alpha: 1.0)
        return navigationItem
    }

Try:

Create one subview in your container view and try to add the custom button and give the functionality. and hook up the button action to your parent func clearImageCache or move this into your child itself. however you want do your customisation.