赞
踩
之前用OC写了UIScrollView,这次用Swift写的,写的不好多担待,O(∩_∩)O~
//先签一下协议
class ViewController: UIViewController , UIScrollViewDelegate {
//Swift没有宏定义,只好定义常量来代替宏定义
let SCROLL_WIDTH = UIScreen.mainScreen().bounds.width
let SCROLL_HEIGHT = UIScreen.mainScreen().bounds.height
var scrollView :UIScrollView? //轮播图
var pageC :UIPageControl? //小点
var timer :NSTimer? //定时器
var scArray :NSMutableArray? //图片数组
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
//图片数组
scArray = ["5.jpg","0.jpg","1.jpg","2.jpg","3.jpg","4.jpg","5.jpg","0.jpg"]
//初始化轮播图
scrollView = UIScrollView.init(frame: UIScreen.mainScr
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。