Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //CODING
- override func viewDidLoad() {
- super.viewDidLoad()
- let cal = NSCalendar.currentCalendar()
- var date = NSDate()
- for i in 1 ... 30 {
- let dateFormatter_week = NSDateFormatter()
- dateFormatter_week.dateFormat = "E"
- let dateFormatter_date = NSDateFormatter()
- dateFormatter_date.dateFormat = "dd"
- var str_week = dateFormatter_week.stringFromDate(date)
- var str_date = dateFormatter_date.stringFromDate(date)
- arr_week.append(str_week)
- arr_date.append(str_date)
- date = cal.dateByAddingUnit(.DayCalendarUnit, value: -1, toDate: date, options:
- nil)!
- }
- }
- func collectionView(collectionView: UICollectionView, numberOfItemsInSection
- section: Int) -> Int {
- return arr_date.count
- }
- func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath:
- NSIndexPath) -> UICollectionViewCell {
- var cell = collectionView.dequeueReusableCellWithReuseIdentifier("cell",
- forIndexPath: indexPath) as myViewCell
- cell.week_label.text = arr_week[indexPath.row]
- cell.date_label.text = arr_date[indexPath.row]
- return cell
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement