Created
December 31, 2012 08:51
-
-
Save satococoa/4418356 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
| class TaskView < UIView | |
| attr_accessor :task, :title, :done, :memo | |
| def initWithFrame(rect) | |
| super.tap do |v| | |
| @title = subview(UILabel, | |
| text: 'タスク', | |
| font: UIFont.fontWithName('HiraKakuProN-W6', size:128), | |
| backgroundColor: UIColor.clearColor, | |
| textColor: UIColor.whiteColor, | |
| adjustsFontSizeToFitWidth: true) | |
| end | |
| end | |
| def layoutSubviews | |
| @title.frame = [ | |
| [30, 10], | |
| [CGRectGetWidth(frame)-(30*2), CGRectGetHeight(frame)-(10*2)] | |
| ] | |
| end | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
できれば
initWithFrameの中でframeも済ませたいんだけど、TaskView.newが呼ばれるためにinitWithFrameの中ではrectが[[0, 0], [0, 0]]になってしまっている。