Class: TestViewController
- Inherits:
-
UIViewController
- Object
- UIViewController
- TestViewController
- Defined in:
- app/test_view_controller.rb
Instance Attribute Summary collapse
-
#sheet ⇒ Object
Returns the value of attribute sheet.
Instance Method Summary collapse
- #share_email_button ⇒ Object
- #share_facebook_button ⇒ Object
- #share_sms_button ⇒ Object
- #share_twitter_button ⇒ Object
- #show_sheet_button ⇒ Object
- #viewDidLoad ⇒ Object
- #viewWillAppear(animated) ⇒ Object
Instance Attribute Details
#sheet ⇒ Object
Returns the value of attribute sheet.
3 4 5 |
# File 'app/test_view_controller.rb', line 3 def sheet @sheet end |
Instance Method Details
#share_email_button ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'app/test_view_controller.rb', line 59 def = UIButton.(UIButtonTypeRoundedRect) .frame = [[15, 100], [290, 25]] .setTitle("Share via mail", forState:UIControlStateNormal) .setTitleColor(UIColor.blackColor, forState:UIControlStateNormal) self.view.addSubview() .whenTapped do email = Sharemotion::SHMEmail.alloc.initWithItem(@item) email.share(self) end end |
#share_facebook_button ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'app/test_view_controller.rb', line 85 def = UIButton.(UIButtonTypeRoundedRect) .frame = [[15, 200], [290, 25]] .setTitle("Share via facebook", forState:UIControlStateNormal) .setTitleColor(UIColor.blackColor, forState:UIControlStateNormal) self.view.addSubview() .whenTapped do facebook = Sharemotion::SHMFacebook.alloc.initWithItem(@item) facebook.share(self) end end |
#share_sms_button ⇒ Object
98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'app/test_view_controller.rb', line 98 def = UIButton.(UIButtonTypeRoundedRect) .frame = [[15, 250], [290, 25]] .setTitle("Share via sms", forState:UIControlStateNormal) .setTitleColor(UIColor.blackColor, forState:UIControlStateNormal) self.view.addSubview() .whenTapped do sms = Sharemotion::SHMSms.alloc.initWithItem(@item) sms.share(self) end end |
#share_twitter_button ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'app/test_view_controller.rb', line 72 def = UIButton.(UIButtonTypeRoundedRect) .frame = [[15, 150], [290, 25]] .setTitle("Share via twitter", forState:UIControlStateNormal) .setTitleColor(UIColor.blackColor, forState:UIControlStateNormal) self.view.addSubview() .whenTapped do twitter = Sharemotion::SHMTwitter.alloc.initWithItem(@item) twitter.share(self) end end |
#show_sheet_button ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'app/test_view_controller.rb', line 34 def = UIButton.(UIButtonTypeRoundedRect) .frame = [[15, 50], [290, 25]] .setTitle("Share", forState:UIControlStateNormal) .setTitleColor(UIColor.blackColor, forState:UIControlStateNormal) self.view.addSubview() .whenTapped do facebook = Sharemotion::SHMFacebook.alloc.initWithItem(@item) {|sharer| sharer.sharer_title = "Bookface" } sharers = [ Sharemotion::SHMEmail.alloc.initWithItem(@item), Sharemotion::SHMSms.alloc.initWithItem(@item), Sharemotion::SHMTwitter.alloc.initWithItem(@item), facebook ] @sheet = Sharemotion::Sheet.alloc.initWithSharers(sharers, controller:self) @sheet.showInView(self.view) end end |
#viewDidLoad ⇒ Object
5 6 7 |
# File 'app/test_view_controller.rb', line 5 def viewDidLoad super end |
#viewWillAppear(animated) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/test_view_controller.rb', line 9 def viewWillAppear(animated) @item = Sharemotion::Item.new({ :title => "Look at that bro!", :url => "http://www.google.fr", :image => "http://www.aujardin.ch/photos/tulipe1.jpg", :text => "You should watch this site, it's incredible", :sharers => { :email => { :to => ["[email protected]", "[email protected]"], :text => "Well you shouldn't..." }, :facebook => { :caption => "OHAI", :title => "HEY HEY" } } }) end |