2

I am creating an app where users will be able to scroll through random images from other users. I am programming in swift and using firebase as my back end. I was able to get my code for icarousel working but I need to change it to account for my firebase users. Any help would be greatly appreciated thanks. My code is below

import UIKit
import Firebase

class FeedVC: UIViewController, iCarouselDataSource, iCarouselDelegate {

    var imageArray : NSMutableArray = NSMutableArray()

    @IBOutlet var ImageDisplay: iCarousel!        

    override func viewDidLoad() {
        super.viewDidLoad()

        //start of display carousel
        imageArray = ["6.jpg", "9.jpg", "10.jpg"]

        ImageDisplay.type = iCarouselType.Rotary
        ImageDisplay.reloadData()            
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.    
    }

    func carousel(carousel: iCarousel, viewForItemAtIndex index: Int, reusingView view: UIView?) -> UIView {

        var imageView : UIImageView!

        if view == nil {
            imageView  = UIImageView(frame: CGRectMake(0, 0, 250, 250))
            imageView.contentMode = .ScaleAspectFit                
        } else {
            imageView = view as! UIImageView
        }

        imageView.image = UIImage(named: "\(imageArray.objectAtIndex(index))")
        return imageView
    }

    func numberOfItemsInCarousel(carousel: iCarousel) -> Int {
        return imageArray.count
    }    
}
ArK
  • 20,698
  • 67
  • 109
  • 136

0 Answers0