Sha256: 739feca26ffc1ab7c44bd348d9558f7b22c02d7aa18c284221d29fb06bc8f589
Contents?: true
Size: 949 Bytes
Versions: 6
Compression:
Stored size: 949 Bytes
Contents
# @requires MotionKit::BaseLayout module MotionKit class BaseLayout def tv? UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomTV end def iphone? UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPhone end def iphone4? iphone? && UIScreen.mainScreen.bounds.size.width == 320 && UIScreen.mainScreen.bounds.size.height == 568 end def iphone35? iphone? && UIScreen.mainScreen.bounds.size.width == 320 && UIScreen.mainScreen.bounds.size.height == 480 end def ipad? UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad end def retina? UIScreen.mainScreen.respond_to?(:scale) && UIScreen.mainScreen.scale == 2 end [:tv, :iphone, :iphone4, :iphone35, :ipad, :retina].each do |method_name| define_method(method_name) do |&block| block.call if self.send("#{method_name}?") end end end end
Version data entries
6 entries across 6 versions & 1 rubygems