Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/99.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 自动水平滚动_Ios_Swift3 - Fatal编程技术网

Ios 自动水平滚动

Ios 自动水平滚动,ios,swift3,Ios,Swift3,我应该怎么做才能像app store那样自动水平滚动 将会有一堆图片。这些图像延迟出现在屏幕上并移出,然后无限重复,就像app store一样。你可以使用它 将此添加到您的pod文件中 pod 'Auk', '~> 7.0' 运行吊舱安装 import UIKit struct DemoConstants { static let button = DemoConstantsButton() static let initialImage = ( fil

我应该怎么做才能像app store那样自动水平滚动

将会有一堆图片。这些图像延迟出现在屏幕上并移出,然后无限重复,就像app store一样。

你可以使用它

将此添加到您的pod文件中

   pod 'Auk', '~> 7.0'
运行吊舱安装

  import UIKit
  struct DemoConstants {



 static let button = DemoConstantsButton()
 static let initialImage = (
    fileName: "slider1.jpg",
    description: " demo"
)
static let localImages = [
    (
        fileName: "image1.jpg",
        description: "Hotel Nirvana"
    ),
    (
        fileName: "image2.jpg",
        description: "Hotel Nirvana"
    ),
    (
        fileName: "image3.jpg",
        description: "demo2"
    ),
    (
        fileName: "image4.jpg",
        description: "demo3"
    ),

    (
        fileName: "image5.jpg",
        description: "demo4"
    ),
    (
        fileName: "image6.jpg",
        description: "demo5"
    )]
    }


    struct DemoConstantsButton {
    let borderWidth: CGFloat = 2
    let cornerRadius: CGFloat = 20
    let borderColor = UIColor.white
    }
在viewcontroller中

   import Auk
添加委托UIScrollViewDelegate

    class yourViewController: UIViewController ,UIScrollViewDelegate 
从宏观上看,做一个出口

           @IBOutlet weak var scrollView: UIScrollView!
在viewDidLoad中

      scrollView.delegate = self
        for localImage in DemoConstants.localImages {


        if let image = UIImage(named: localImage.fileName) {
            scrollView.auk.show(image: image)
      }}





    let pageIndex = scrollView.auk.currentPageIndex
    print(pageIndex!)



    scrollView.auk.settings.contentMode = UIViewContentMode.scaleAspectFill
    scrollView.auk.settings.pagingEnabled = true
    self.scrollView.auk.settings.pageControl.backgroundColor = UIColor.black
    scrollView.auk.startAutoScroll(delaySeconds: 3)
    scrollView.auk.scrollToPage(atIndex: 2, animated: true)

检查它只是一个滚动,但我要找的是“自动”滚动。不过谢谢你的建议。很抱歉,我不知怎么错过了自动滚动。你检查过iCarousel库吗?它有autoScroll属性,你可以将其设置为真并启用水平滚动。谢谢Ellen。我也在查看该库。感谢您的帮助:)因此,请单击右勾按钮验证我的解决方案是否解决了您的问题,我们将不胜感激