Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 4    Views: 97

mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
01/25/14 08:20 AM (10 years ago)

BT30 - Day 21 - Invisible button for button menu

BT30 is my personal project to contribute to buzztouch: https://www.buzztouch.com/forum/thread.php?fid=2348BA49BA5737C92E3D9B5&tid=2348BA49BA5737C92E3D9B5 Day 21 - Invisible button for button menu ------------- DESCRIPTION ------------- Big thanks to Kittsy for helping me on this and giving code. This is very usefull for those who are using the Menu with Buttons plugin. Say you are using the menu with buttons plugins, and you want to display some logo or some image that goes somewhere at the bottom, like a big button. You can now do that. Here is the example (horrible, done in paint, dont judge): http://s23.postimg.org/6w86oi68r/example.png So say you use 12 buttons, your screen still has space at the bottom, you make a background image that makes use of that bottom with some logo or some image that says click here to go to X. With this code you can place a invisible button there linking to a buzztouch screen of your choice. ------------- CODE ------------- 1. In your buttons menu .m file: add this to the bottom of the viewdidload method under //add the scrollview [self.view addSubview:myScrollView]; around line 125 UIButton *hiddenButton = [[UIButton buttonWithType:UIButtonTypeCustom] retain]; //set where the button starts from left hand corner int topLeftCornerX = 0; int topLeftCornerY = 200; // button size int widthOfButton = 320; int heightOfButton = 50; hiddenButton.frame = CGRectMake(topLeftCornerX, topLeftCornerY, widthOfButton, heightOfButton); // this is red so you can see where it is change to clear when ready hiddenButton.backgroundColor = [UIColor redColor]; // thissets the tap [hiddenButton addTarget:self action:@selector(hiddenButtonPress) forControlEvents:UIControlEventTouchUpInside]; // this adds it the view notice it's added last so it goes over the scroll view [self.view addSubview:hiddenButton]; then add this method outside of any curly braces - (void)hiddenButtonPress{ BT_appDelegate *appDelegate = (BT_appDelegate *)[[UIApplication sharedApplication] delegate]; BT_item *screenToLoad = [appDelegate.rootApp getScreenDataByNickname:@"none"]; [BT_viewControllerManager handleTapToLoadScreen:nil theMenuItemData:nil theScreenData:screenToLoad]; } ---------------------------- You're done! Make sure to change BT_appDelegate to YOURAPPNAME_appDelegate (your project name), all instances). Also make sure to change "none" to your screen name of choice! Hope this helps someone. David.
 
shak77
buzztouch Evangelist
Profile
Posts: 399
Reg: Jan 18, 2011
location unknow...
7,240
like
01/25/14 11:14 AM (10 years ago)
Nice! Thanks David!
 
MadRod
Aspiring developer
Profile
Posts: 1853
Reg: Apr 12, 2012
Lisbon
27,930
like
01/25/14 02:21 PM (10 years ago)
Super cool. Thanks
 
Annonymous
Profile
01/26/14 10:34 AM (10 years ago)
Interesting technique to always send the user to somewhere! Thanks for the Tips! -- Niraj
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
01/30/14 03:41 PM (10 years ago)
No problem, Mr. Anoniraj :) David
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.