var
title0:
UILabel
!
override func viewDidLoad() {
super . viewDidLoad ()
// Do any additional setup after loading the view, typically from a nib.
title0 = UILabel (frame: CGRectMake ( 50 , 50 , 200 , 30 ))
title0 . text = " 热门目的地 "
title0 . font = UIFont . systemFontOfSize ( 14 )
view . addSubview ( title0 )
}
var tagarr = "aaa#bbb#ccc#ddd#eee#fff# 搞笑 # 体育 # 娱乐 " . componentsSeparatedByString ( "#” )
func collectionView(collectionView: UICollectionView , numberOfItemsInSection section: Int ) -> Int {
return tagarr . count
}
func collectionView(collectionView: UICollectionView , cellForItemAtIndexPath indexPath: NSIndexPath ) -> UICollectionViewCell {
var cell = collectionView. dequeueReusableCellWithReuseIdentifier ( "tagcell" , forIndexPath: indexPath) as TagCollectionViewCell
cell. labview . text = tagarr [indexPath. row ]
cell. labview . layer . borderWidth = 1.0
cell. labview . layer . borderColor = UIColor . redColor (). CGColor
return cell
}
override func viewDidLoad() {
super . viewDidLoad ()
// Do any additional setup after loading the view, typically from a nib.
title0 = UILabel (frame: CGRectMake ( 50 , 50 , 200 , 30 ))
title0 . text = " 热门目的地 "
title0 . font = UIFont . systemFontOfSize ( 14 )
view . addSubview ( title0 )
}
var tagarr = "aaa#bbb#ccc#ddd#eee#fff# 搞笑 # 体育 # 娱乐 " . componentsSeparatedByString ( "#” )
func collectionView(collectionView: UICollectionView , numberOfItemsInSection section: Int ) -> Int {
return tagarr . count
}
func collectionView(collectionView: UICollectionView , cellForItemAtIndexPath indexPath: NSIndexPath ) -> UICollectionViewCell {
var cell = collectionView. dequeueReusableCellWithReuseIdentifier ( "tagcell" , forIndexPath: indexPath) as TagCollectionViewCell
cell. labview . text = tagarr [indexPath. row ]
cell. labview . layer . borderWidth = 1.0
cell. labview . layer . borderColor = UIColor . redColor (). CGColor
return cell
}