Created
January 19, 2015 19:45
Revisions
-
TheKidCoder created this gist
Jan 19, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ def email_text_field return @email_text_field if @email_text_field @email_text_field = UITextField.alloc.initWithFrame([[0, 0], [225, 40]]) @email_text_field.center = CGPointMake(self.view.frame.size.width / 2, (self.view.frame.size.height / 2) - 60) @email_text_field.placeholder = "[email protected]" @email_text_field.borderStyle = UITextBorderStyleRoundedRect @email_text_field end #Smaller variable names... def email_text_field return @email_text_field if @email_text_field @email_text_field = UITextField.alloc.initWithFrame([[0, 0], [225, 40]]) @email_text_field.tap do |tf| tf.center = CGPointMake(self.view.frame.size.width / 2, (self.view.frame.size.height / 2) - 60) tf.placeholder = "[email protected]" tf.borderStyle = UITextBorderStyleRoundedRect end @email_text_field end # Memoize all in one. def email_text_field return @email_text_field ||= UITextField.alloc.initWithFrame([[0, 0], [225, 40]]).tap do |tf| tf.center = CGPointMake(self.view.frame.size.width / 2, (self.view.frame.size.height / 2) - 60) tf.placeholder = "[email protected]" tf.borderStyle = UITextBorderStyleRoundedRect end end