Class: UITabBarItem
- Defined in:
- lib/ios/sugarcube-factories/uitabbaritem.rb
Overview
Factory methods for UITabBarItem. I’ve never understood why UITabBarItem makes it so easy to set the view tag, but these methods do not require you to do so.
Class Method Summary collapse
- .bookmarks(options = {}) ⇒ Object
- .contacts(options = {}) ⇒ Object
- .downloads(options = {}) ⇒ Object
- .favorites(options = {}) ⇒ Object
- .featured(options = {}) ⇒ Object
- .history(options = {}) ⇒ Object
- .more(options = {}) ⇒ Object
- .most_recent(options = {}) ⇒ Object
- .most_viewed(options = {}) ⇒ Object
- .recents(options = {}) ⇒ Object
- .search(options = {}) ⇒ Object
- .system(type, options = {}) ⇒ Object
- .titled(title, options = {}) ⇒ Object
- .top_rated(options = {}) ⇒ Object
Class Method Details
.bookmarks(options = {}) ⇒ Object
67 68 69 |
# File 'lib/ios/sugarcube-factories/uitabbaritem.rb', line 67 def bookmarks(={}) return self.system(UITabBarSystemItemBookmarks, ) end |
.contacts(options = {}) ⇒ Object
59 60 61 |
# File 'lib/ios/sugarcube-factories/uitabbaritem.rb', line 59 def contacts(={}) return self.system(UITabBarSystemItemContacts, ) end |
.downloads(options = {}) ⇒ Object
75 76 77 |
# File 'lib/ios/sugarcube-factories/uitabbaritem.rb', line 75 def downloads(={}) return self.system(UITabBarSystemItemDownloads, ) end |
.favorites(options = {}) ⇒ Object
43 44 45 |
# File 'lib/ios/sugarcube-factories/uitabbaritem.rb', line 43 def favorites(={}) return self.system(UITabBarSystemItemFavorites, ) end |
.featured(options = {}) ⇒ Object
47 48 49 |
# File 'lib/ios/sugarcube-factories/uitabbaritem.rb', line 47 def featured(={}) return self.system(UITabBarSystemItemFeatured, ) end |
.history(options = {}) ⇒ Object
63 64 65 |
# File 'lib/ios/sugarcube-factories/uitabbaritem.rb', line 63 def history(={}) return self.system(UITabBarSystemItemHistory, ) end |
.more(options = {}) ⇒ Object
39 40 41 |
# File 'lib/ios/sugarcube-factories/uitabbaritem.rb', line 39 def more(={}) return self.system(UITabBarSystemItemMore, ) end |
.most_recent(options = {}) ⇒ Object
79 80 81 |
# File 'lib/ios/sugarcube-factories/uitabbaritem.rb', line 79 def most_recent(={}) return self.system(UITabBarSystemItemMostRecent, ) end |
.most_viewed(options = {}) ⇒ Object
83 84 85 |
# File 'lib/ios/sugarcube-factories/uitabbaritem.rb', line 83 def most_viewed(={}) return self.system(UITabBarSystemItemMostViewed, ) end |
.recents(options = {}) ⇒ Object
55 56 57 |
# File 'lib/ios/sugarcube-factories/uitabbaritem.rb', line 55 def recents(={}) return self.system(UITabBarSystemItemRecents, ) end |
.search(options = {}) ⇒ Object
71 72 73 |
# File 'lib/ios/sugarcube-factories/uitabbaritem.rb', line 71 def search(={}) return self.system(UITabBarSystemItemSearch, ) end |
.system(type, options = {}) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ios/sugarcube-factories/uitabbaritem.rb', line 28 def system(type, ={}) type = type. if type.respond_to?(:uitabbarsystemitem) tag = .fetch(:tag, 0) badge = [:badge] item = self.alloc.initWithTabBarSystemItem(type, tag: tag) if badge item.badgeValue = badge.to_s end return item end |
.titled(title, options = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ios/sugarcube-factories/uitabbaritem.rb', line 7 def titled(title, ={}) tag = .fetch(:tag, 0) image = [:image] badge = [:badge] if image && image.respond_to?(:uiimage) image = image.uiimage end selected_image = [:selected_image] if selected_image && selected_image.respond_to?(:uiimage) selected_image = selected_image.uiimage end item = self.alloc.initWithTitle(title, image: image, selectedImage: selected_image) if tag item.tag = tag end if badge item.badgeValue = badge.to_s end return item end |
.top_rated(options = {}) ⇒ Object
51 52 53 |
# File 'lib/ios/sugarcube-factories/uitabbaritem.rb', line 51 def top_rated(={}) return self.system(UITabBarSystemItemTopRated, ) end |