Module: ProMotion::ScreenModule::ClassMethods

Defined in:
lib/ProMotion/screen/screen_module.rb

Overview

Class methods

Instance Method Summary collapse

Instance Method Details

#title(t = nil) ⇒ Object



166
167
168
169
170
171
172
173
174
# File 'lib/ProMotion/screen/screen_module.rb', line 166

def title(t=nil)
  if t && t.is_a?(String) == false
    PM.logger.deprecated "You're trying to set the title of #{self.to_s} to an instance of #{t.class.to_s}. In ProMotion 2+, you must use `title_image` or `title_view` instead."
    return raise StandardError
  end
  @title = t if t
  @title_type = :text if t
  @title ||= self.to_s
end

#title_image(t) ⇒ Object



180
181
182
183
# File 'lib/ProMotion/screen/screen_module.rb', line 180

def title_image(t)
  @title = t.is_a?(UIImage) ? t : UIImage.imageNamed(t)
  @title_type = :image
end

#title_typeObject



176
177
178
# File 'lib/ProMotion/screen/screen_module.rb', line 176

def title_type
  @title_type || :text
end

#title_view(t) ⇒ Object



185
186
187
188
# File 'lib/ProMotion/screen/screen_module.rb', line 185

def title_view(t)
  @title = t
  @title_type = :view
end