Created
June 23, 2015 00:07
-
-
Save trestles/9fe5313bb354bb96b932 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func renderTopMenuItemView(){ | |
var miTopViewRunningY: CGFloat = 10.0 | |
let miTopView=UIView() | |
miTopView.frame = CGRectMake(0, 64, self.screenWidth, 100) | |
miTopView.backgroundColor = UIColor.yellowColor() | |
miTopView.layer.borderColor=UIColor.blackColor().CGColor | |
miTopView.layer.borderWidth=2.0 | |
let miHeader=UILabel(frame: CGRectMake(0, miTopViewRunningY , 400, CGFloat.max)) | |
miHeader.text=self.menuItem.header | |
miHeader.numberOfLines=0 | |
miHeader.lineBreakMode = NSLineBreakMode.ByWordWrapping | |
miHeader.sizeToFit() | |
miHeader.frame = CGRectMake(10, 10, 400, miHeader.frame.size.height) | |
miTopView.addSubview(miHeader) | |
miTopViewRunningY += miHeader.frame.size.height + 5.0 | |
if(!self.menuItem.detail.isEmpty){ | |
println("The string is not empty") | |
let miDetail=UILabel(frame: CGRectMake(0, miTopViewRunningY, 400, CGFloat.max)) | |
miDetail.text=self.menuItem.detail | |
miDetail.numberOfLines=0 | |
miDetail.lineBreakMode = NSLineBreakMode.ByWordWrapping | |
miDetail.sizeToFit() | |
miDetail.frame = CGRectMake(10, miTopViewRunningY, 400, miDetail.frame.size.height) | |
miTopView.addSubview(miDetail) | |
miTopViewRunningY += miDetail.frame.size.height + 5.0 | |
} | |
miTopView.frame = CGRect(x: 0, y: 64, width: self.screenWidth, height: miTopViewRunningY) | |
self.view.addSubview(miTopView) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment