title: UICollectionView last cell not aligned
body: <p>I am new to iOS and I now have an issue.</p>
  
  <p>My goal is to get a sliding bar with filtering buttons on it.
  I have a UICollectionView as a subview in some other view all is displaying well except for the last cell.</p>
  
  <p><img src="https://i.stack.imgur.com/p3kLD.png" alt="The display of the uicollectionview"></p>
  
  <p>Here is the delegate and datesource of the uicollectionview</p>
  
  <pre><code>class PmtCategoryCollectionViewController: UICollectionViewController {
  var categories = ["Mediterranean", "Italian", "French", "Chinese", "American", "Indian"]
  
  var buttonDistanceToEachOther: CGSize = CGSize(width: 20, height: 60)
  var fontOnCategoryButton = UIFont.systemFontOfSize(15.0)
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      // Uncomment the following line to preserve selection between presentations
      // self.clearsSelectionOnViewWillAppear = false
  
      // Register cell classes
      self.collectionView!.registerClass(UICollectionViewCell.self, forCellWithReuseIdentifier: reuseIdentifier)
  
      // Do any additional setup after loading the view.
  }
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
  }
  
  override func numberOfSectionsInCollectionView(collectionView: UICollectionView) -&gt; Int {
      //#warning Incomplete method implementation -- Return the number of sections
      return 1
  }
  
  
  override func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -&gt; Int {
      //#warning Incomplete method implementation -- Return the number of items in the section
      println(categories.count)
      return categories.count
  }
  
  override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -&gt; UICollectionViewCell {
      let cell = collectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forIndexPath: indexPath) as! PmtCategoryCollectionViewCell
  
      // Configure the cell
      println(categories[indexPath.row])
      cell.category = categories[indexPath.row]
      return cell
  }
  
  
  // determine the size of each cell
  func collectionView(collectionView: UICollectionView,
      layout collectionViewLayout: UICollectionViewLayout,
      sizeForItemAtIndexPath indexPath: NSIndexPath) -&gt; CGSize {
          var text = categories[indexPath.row]
          var size: CGSize = NSString.sizeWithAttributes(text)([NSFontAttributeName:fontOnCategoryButton])
          size.height += buttonDistanceToEachOther.height
          size.width += buttonDistanceToEachOther.width
          return size
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>The size of all the cells are:</p>
  
  <pre><code>Size is (118.91, 72.895)
  Size is (37.52, 72.895)
  Size is (60.77, 72.895)
  Size is (67.025, 72.895)
  Size is (75.5, 72.895)
  Size is (84.545, 72.895)
  Size is (61.745, 72.895)
  Size is (176.21, 72.895) 
  </code></pre>
  
  <p>Any help would be great!</p>