Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 29    Views: 122

mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
07/26/13 02:18 PM (12 years ago)

Invisible Button Area for Button menu

Hi guys, Have a client that gave me a specific background for his button menu screen, and he has a nice little logo at the bottom that he wants clickable to a custom url screen. I have attached my "example" of what I need done. Can anyone help me out on this? I'm figuring I need to set an invisible area that after a tap initiates a load screen ID method (since it wouldnt be connected to the control panel, it would need to go to the hard coded custom irl screen). Please let me know if anyone can help me on this issue. Would be greatly appreciated! http://s21.postimg.org/67o2mwxtz/invisible_button_for_button_menu.png Currently I'm figuring out how to launch a screen by hardcode. if([[BT_strings getStyleValueForScreen:thisMenuItem:@"loadScreenWithItemId":@""] isEqualToString:@"4F649FAFD0CA6BF6B711822"]){ LAUNCH CUSTOM URL } else if { blablablabla } } David
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
07/26/13 03:01 PM (12 years ago)
why don't you use the xib menu plugin that would solve your probs easier than having to change code The problem with this menu is that it is in a scroll view so it's not easy to add a button as the screen constraints vary. As to loading a screen it's 3 lines if you are hard coding BT_appDelegate *appDelegate = (BT_appDelegate *)[[UIApplication sharedApplication] delegate]; BT_item *screenToLoad = [appDelegate.rootApp getScreenDataByNickname:@"screenNickname"]; [BT_viewControllerManager handleTapToLoadScreen:nil theMenuItemData:nil theScreenData:screenToLoad];
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
07/26/13 03:02 PM (12 years ago)
@"screenNickname" change that to the nick name. I find it easier to use the screen nickname as it's more visual to what you are loading instead of a long alpha numerical string.
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
07/26/13 03:07 PM (12 years ago)
Sounds like a good reason to create a custom plugin :)
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
07/26/13 03:33 PM (12 years ago)
@Kitsy yes I agree the XIB menu would do the trick, however, the client wants to control the buttons from the control panel, which he cannot do with the XIB menu. There will be only 12 buttons at a time (like in my example picture). Taking a look at your code.. @Chris, I would contact you but I need this done within a few days and I know your backed up for weeks :( Unless this is easy for you..? David
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
07/26/13 03:37 PM (12 years ago)
Well, I'm about to go camping for the weekend, so if you need it by Monday I'd be out. But, yeah, this should be a really easy plugin to create - especially if it's always exactly 12 buttons on top.
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
07/26/13 03:54 PM (12 years ago)
The xib menu has 12 buttons controllable in the control panel its easy enough to hard code your invisible 13th button
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
07/26/13 04:28 PM (12 years ago)
Hi Kittsy, you're totally right, however, if the client wants to move the buttons around or switch icons, they wouldn't be able too (and I know this client will end up wanting that). If they were not so stubborn it would make sense. Unfortunately, the only way to make this work is to modify the current button menu plugin. I took a look at your code... awesome! Still no idea how to make a invisible "area" that can become clickable. Any idea? @Chris, its possible for-sure, but I would really like it to get done tonight or tomorrow. If I can't figure this out or hire someone else then I will email you asap on Monday. Thanks.
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
07/26/13 04:41 PM (12 years ago)
For the how, create a UIView and set a tap gesture. Or on Android, create a blank textView and set an onClickListener
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
07/26/13 05:08 PM (12 years ago)
add this to the bottom of the viewdidappear 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]; }
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
07/26/13 05:10 PM (12 years ago)
don't forget to change the appdelegate name. note i have made the button red so you can see where it is moving to. No need to overcomplicate matters, UIButton is a subclass of uiview got it's own gestures and such built in
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
07/26/13 05:22 PM (12 years ago)
where it says none is the screen nickname just so happens my test screen was called none just to confuse you lol
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
07/26/13 05:26 PM (12 years ago)
Kittsy you are awesome! Do you accept donations? I'll test this out ASAP out, typing on iPhone. David
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
07/26/13 05:28 PM (12 years ago)
Good lookin out Kittsy. I'm on my phone, do couldn't really draft any code
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
07/26/13 05:32 PM (12 years ago)
why not add an image to the button [hiddenButton setImage:[UIImage imageNamed:@"yourImage.png"] forState:UIControlStateNormal]; that way you don't have to place it over the pic, the button is wherever you put it, make it easier for different screen sizes
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
07/26/13 05:44 PM (12 years ago)
@chris I never normally get to answer these questions, as you guys are all awake while I'm asleep lol @MrDavid lets see if the code does the job for you before you start throwing cash at me. I'm getting married next Saturday then off to the Dominican Republic so any dollars would be welcome lol
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
07/26/13 06:10 PM (12 years ago)
Congrats Kittsy!
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
07/26/13 06:47 PM (12 years ago)
Congratulations Kittsy! Not to be gauche, but I don't suppose your bride-to-be is an Android wiz, is she? ;) Cheers! -- Smug
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
07/26/13 09:58 PM (12 years ago)
Kittsy, your code worked PERFECTLY. Was able to customize it with ease (after a 10 second integration) and it works great both on i4 and i5! Send me a message with your paypal and I'll send a quick thank you. Client will love to know that he can get this functionality. Will most likely tweak your code to a few other plugins. Thanks again, and congratulations! David
 
Susan Metoxen
buzztouch Evangelist
Profile
Posts: 1706
Reg: May 01, 2011
Hopkins, Minnes...
26,260
like
07/26/13 10:43 PM (12 years ago)
Kittsy, you are such a hero! Best wishes!
 
mutzy
Aspiring developer
Profile
Posts: 841
Reg: Nov 03, 2010
Medford, MA
9,860
like
07/26/13 10:52 PM (12 years ago)
Glad it worked out! In the future though, you can control the xib button menu from the control panel. josh
 
SheriDee
Code is Art
Profile
Posts: 1094
Reg: Sep 23, 2011
location unknow...
22,840
like
07/26/13 10:56 PM (12 years ago)
Oh...wow way to Sneak that in ...btw I am getting married...pass the salt...Brits I am telling you....Listen you keep this girl you hear me? So many nights we listen to how many times you were sent to the couch on Buzztouch ? This girl needs a medal... and for the love of God turn off the wifi!!! Smart lady to get you on a remote island for the honeymoon ;) Seriously, all the best to you Andy you deserve all the happiness in the world!!!!!!!!
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
07/26/13 10:57 PM (12 years ago)
@mutzy Yes I know, but as I mentioned already before in this post is that the XIB would not have given my client ENOUGH control from the control panel: 1. he would not be able to change the button colors or radius. 2. he would not have been able to re-organize them. 3. he would not have been able to re-label them or remove them if needed. These functions would have been lost, switching the button to a different screen was simply not enough for me. XIB is a awesome plugin, but was totally unpractical for my client and this situation. I have used it many times and for personal use it is AWESOME! :-) Thanks again all! David
 
PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
like
07/27/13 01:23 AM (12 years ago)
Jumping in! Code looks cool and congratulations @Kittsy Best Regards, Danny
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
07/27/13 02:00 AM (12 years ago)
Thanks for the congrats guys and gals. Staying up till 3 in the morning on Buzztouch may mean I won't be married for long.
 
mysps
Code is Art
Profile
Posts: 2082
Reg: May 14, 2011
Palma
33,320
like
07/27/13 01:39 PM (12 years ago)
Great code Kittsy!! Congrats as well. Enjoy the island :)
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
07/28/13 07:52 PM (12 years ago)
Congrats you too Sheri!
 
Susan Metoxen
buzztouch Evangelist
Profile
Posts: 1706
Reg: May 01, 2011
Hopkins, Minnes...
26,260
like
07/28/13 08:39 PM (12 years ago)
I am glad this is solved, but I am not sure I understand why this couldn't have been done with the XIB menu. Couldn't you would just make an invisible button in the Xib file, and you could control it from the control panel? The pretend button would be changed on the background image although that is a bit tricky with different phone sizes. To get around the two iphone sizes, you could just stretch the height of the invisible button.
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
07/29/13 12:30 AM (12 years ago)
I beleive the main reason Susan is complete lack of customisation from the control panel. MrDavid's client wishes to be able to change the background pics colour, images of buttons, text color, transitions etc that is available on the simple button menu.
 
Susan Metoxen
buzztouch Evangelist
Profile
Posts: 1706
Reg: May 01, 2011
Hopkins, Minnes...
26,260
like
07/29/13 11:46 AM (12 years ago)
Oh, I see. I think I assumed he could use the background image for that, but I think he would run into problems without a set place for the button.
 

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.