Module: ProMotion::ScreenModule::ClassMethods

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

Overview

Class methods

Instance Method Summary collapse

Instance Method Details

#get_nav_bar_buttonObject



259
260
261
# File 'lib/ProMotion/screen/screen_module.rb', line 259

def get_nav_bar_button
  @nav_bar_button_args
end


254
255
256
257
# File 'lib/ProMotion/screen/screen_module.rb', line 254

def nav_bar_button(side, args={})
  @nav_bar_button_args = args
  @nav_bar_button_args[:side] = side
end

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



238
239
240
241
242
243
244
# File 'lib/ProMotion/screen/screen_module.rb', line 238

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

#status_bar_animationObject



250
251
252
# File 'lib/ProMotion/screen/screen_module.rb', line 250

def status_bar_animation
  @status_bar_animation || UIStatusBarAnimationSlide
end

#status_bar_typeObject



246
247
248
# File 'lib/ProMotion/screen/screen_module.rb', line 246

def status_bar_type
  @status_bar_style || :default
end

#title(t = nil) ⇒ Object



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

def title(t=nil)
  if t && t.is_a?(String) == false
    mp "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.", force_color: :yellow
    return raise StandardError
  end
  @title = t if t
  @title_type = :text if t
  @title ||= self.to_s
end

#title_image(t) ⇒ Object



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

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

#title_typeObject



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

def title_type
  @title_type || :text
end

#title_view(t) ⇒ Object



233
234
235
236
# File 'lib/ProMotion/screen/screen_module.rb', line 233

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