自动水平滚动

时间:2017-07-31 10:16:05

标签: ios swift3

我应该像app store一样对自动水平滚动做什么?

会有一堆图像。这些带有一些延迟的图像会出现在屏幕上并移出,这会像app store一样无限重复。

1 个答案:

答案 0 :(得分:1)

你可以用这个

https://github.com/evgenyneu/Auk

将其添加到您的pod文件

FROM django:onbuild
# Install Python dependencies
RUN  pip install django
#CMD ["pwd"]
RUN ./manage.py makemigrations
RUN ./manage.py migrate
#RUN ./manage.py collectstatic
EXPOSE 8002
#Run Server
CMD ./manage.py runserver 127.0.0.1:8002

运行pod install

   pod 'Auk', '~> 7.0'

在你的viewcontroller中

  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
    }

添加委托UIScrollViewDelegate

   import Auk

采取UIScrollView并建立一个出口

    class yourViewController: UIViewController ,UIScrollViewDelegate 

在viewDidLoad

           @IBOutlet weak var scrollView: UIScrollView!