class DetailController < UIViewController def loadView self.view = UIScrollView.alloc.initWithFrame(UIScreen.mainScreen.applicationFrame) view.autoresizingMask = UIViewAutoresizingFlexibleHeight view.autoresizesSubviews = true view.backgroundColor = UIColor.whiteColor @text_label = UILabel.alloc.init @text_label.numberOfLines = 0 view.addSubview(@text_label) end def viewDidLoad navigationItem.title = "Sample Text" end def viewDidAppear(animated) font = UIFont.fontWithName(@font_name, size:16) frame_size = sample_text.sizeWithFont(font, constrainedToSize:[self.view.bounds.size.width - 20, 1000], lineBreakMode:UILineBreakModeWordWrap) rect = [[10, 10], [frame_size.width, frame_size.height]] @text_label.text = sample_text @text_label.frame = rect @text_label.font = font view.contentSize = [self.view.frame.size.width, frame_size.height + 20] end def selected_font(font_name) @font_name = font_name end def sample_text <