Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

Commit

Permalink
We using auto layout so is no need
Browse files Browse the repository at this point in the history
  • Loading branch information
TorIsHere committed Jun 27, 2015
1 parent 4b88178 commit 8d93d22
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions benri/MenuCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,21 @@ class MenuCell: UITableViewCell {

func resizePriceLabelFrame(priceText: String){
//Calculate the expected size based on the font and linebreak mode of your label
var maximumLabelSize: CGSize = CGSizeMake(320, 50)
var maximumLabelSize: CGSize = CGSizeMake(320, 60)
let myPriceText: NSString = priceText as NSString
let expectedLabelSize: CGSize = myPriceText.sizeWithAttributes([NSFontAttributeName: UIFont.systemFontOfSize(17.0)])

let screenSize: CGRect = UIScreen.mainScreen().bounds
let screenWidth = screenSize.width

var newFrame: CGRect = priceLabel.frame
var newFrame: CGRect = self.priceLabel.frame
newFrame.size.width = round(expectedLabelSize.width)
newFrame.origin.x = screenWidth - newFrame.size.width
newFrame.size.height = round(expectedLabelSize.height) + 500

priceLabel.text = priceText
priceLabel.frame = newFrame
priceLabel.textAlignment = NSTextAlignment.Center
self.priceLabel.text = priceText
self.priceLabel.frame = newFrame
self.priceLabel.textAlignment = NSTextAlignment.Center

}

Expand All @@ -112,7 +113,7 @@ class MenuCell: UITableViewCell {

let currencySymbol = CurrencyConverter.codeToSymbol(currencyCode)
priceText = " " + currencySymbol + " " + priceText + " "
resizePriceLabelFrame(priceText)
self.priceLabel.text = priceText
}

func _getPriceLabel() -> String? {
Expand Down

0 comments on commit 8d93d22

Please sign in to comment.