var
iFortime:
CGFloat
=
0.0
var
time=
NSTimer
()
//
轮播效果
time
=
NSTimer
.
scheduledTimerWithTimeInterval
(
2.0
, target:
self
, selector:
"changeImg"
, userInfo:
nil
, repeats:
true
)
func
changeImg(){
UIView . animateWithDuration ( 0.5 , animations: { () -> Void in
self . scrollview . contentOffset = CGPointMake ( self . scrollview . frame . width * self . iFortime , 0 )
print ( self . scrollview . bounds . width * self . iFortime )
}, completion: nil )
iFortime ++
if ( iFortime > 2 ){
iFortime = 0
}
UIView . animateWithDuration ( 0.5 , animations: { () -> Void in
self . scrollview . contentOffset = CGPointMake ( self . scrollview . frame . width * self . iFortime , 0 )
print ( self . scrollview . bounds . width * self . iFortime )
}, completion: nil )
iFortime ++
if ( iFortime > 2 ){
iFortime = 0
}