+
Skip to content

Slider not showing it self when you try to add 3 images or more #74

@0xjorgev

Description

@0xjorgev
  • Library setup method: CocoaPods
  • Version of the library. Example: 8.0.
  • Xcode version. Example: 9.2.
  • OS version. Example: iOS 11.2.

Hi there!, first of all thanks for this amazing software component, i'd used moa in the past and Auk it's a very elegant solution for image sliders for the iOS platform!.

My issue goes like this:

I am using Auk to add an image slider as a tableView Header, in a project that doesn't use Storyboards, for that porpoise i had created a separated class with all the needed setup:

`
import UIKit
import moa
import Auk

class CategoryNecessitiesTableViewHeader: UIView, UIScrollViewDelegate {

var scroll:UIScrollView?

var contentInnverView:UIView?

override init(frame: CGRect) {
    super.init(frame: frame)
    createViews()
}

required init?(coder aDecoder: NSCoder) {
    fatalError("init(coder:) has not been implemented")
}

func createViews(){
    Moa.logger = MoaConsoleLogger
    self.scroll = UIScrollView()
    self.contentInnverView = UIView()
    self.scroll?.delegate = self
    
    self.scroll?.auk.settings.showsHorizontalScrollIndicator = true
    self.scroll?.auk.settings.pageControl.visible = true
    self.scroll?.auk.settings.pagingEnabled = true
    self.scroll?.auk.settings.pageControl.backgroundColor = UIColor.gray.withAlphaComponent(0.3)
    self.scroll?.auk.settings.pageControl.currentPageIndicatorTintColor = .appBlue
    self.scroll?.auk.settings.pageControl.pageIndicatorTintColor = .gray
    self.scroll?.auk.settings.pageControl.backgroundColor = .clear
    self.scroll?.auk.settings.contentMode = .scaleAspectFill
    self.scroll?.auk.settings.preloadRemoteImagesAround = 1
    self.scroll?.auk.settings.placeholderImage = UIImage(named: "empty_just")
    self.scroll?.auk.settings.errorImage = UIImage(named: "empty_just")
    
    if #available(iOS 11.0, *) {
        self.scroll?.contentInsetAdjustmentBehavior = .always
    }
    
    self.contentInnverView?.addSubview(self.scroll!)
    self.addSubview(contentInnverView!)
    setupConstraints()
}

func setup(images:[String]?){            
        self.scroll?.auk.removeAll()
        if let imgs = images {
           _ = imgs.map{ scroll?.auk.show(url: $0) }
      }
}

func setScrollImages(images:[String]?) {
    self.scroll?.auk.removeAll()
    _ = images.map{ $0.map{ scroll?.auk.show(url: $0) }}
}

func setupConstraints(){
    let size = CGSize(width: UIScreen.main.bounds.width, height: 250.0)
    let sizeSmaller = CGSize(width: UIScreen.main.bounds.width, height: 210.0)
    self.autoSetDimensions(to: size)
    self.contentInnverView?.autoSetDimensions(to:sizeSmaller)
    self.scroll?.autoPinEdgesToSuperviewEdges()
}

}
`

The thing is if i send one or two images the slider works perfect, it shows loads the images, shows the pager controller and the world is a happy place, how ever if i send an array o 3 or more images it simply shows nothing in the screen, Thanks before hand!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载