Module: ProMotion::ScreenModule::ClassMethods

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

Overview

Class methods

Instance Method Summary collapse

Instance Method Details

#status_bar(style = nil, args = {}) ⇒ Object



217
218
219
220
221
222
223
# File 'lib/ProMotion/screen/screen_module.rb', line 217

def status_bar(style=nil, args={})
  if NSBundle.mainBundle.objectForInfoDictionaryKey('UIViewControllerBasedStatusBarAppearance').nil?
    PM.logger.warn("status_bar will have no effect unless you set 'UIViewControllerBasedStatusBarAppearance' to false in your info.plist")
  end
  @status_bar_style = style
  @status_bar_animation = args[:animation] if args[:animation]
end

#status_bar_animationObject



229
230
231
# File 'lib/ProMotion/screen/screen_module.rb', line 229

def status_bar_animation
  @status_bar_animation || UIStatusBarAnimationSlide
end

#status_bar_typeObject



225
226
227
# File 'lib/ProMotion/screen/screen_module.rb', line 225

def status_bar_type
  @status_bar_style || :default
end

#title(t = nil) ⇒ Object



193
194
195
196
197
198
199
200
201
# File 'lib/ProMotion/screen/screen_module.rb', line 193

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



207
208
209
210
# File 'lib/ProMotion/screen/screen_module.rb', line 207

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

#title_typeObject



203
204
205
# File 'lib/ProMotion/screen/screen_module.rb', line 203

def title_type
  @title_type || :text
end

#title_view(t) ⇒ Object



212
213
214
215
# File 'lib/ProMotion/screen/screen_module.rb', line 212

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