Discussion Forums  >  Uncategorized

Replies: 18    Views: 436

dolfinsfan23
I hate code!
Profile
Posts: 24
Reg: Jul 28, 2011
Miami
240
09/23/11 08:25 PM (14 years ago)

PLUGINS

Anybody please answer with help, I want a tool bar (not a tab bar) on the bottom of my html doc screen. I know how to get a toolbar but buzz touch only has refresh, back, email, and open in native browser. I want to link one of those buttons to link to a java script code to change the theme of the html (or for the sake of this have one of those buttons link to google.) I did this in a separate Xcode app. that Xcode app opens with an html, and a toolbar on the bottom that can do what i want. can i use that as a custom plugin or is there an easier way to do through buzz touch. also how would i set up the plugin. Thanks in advance:) Again any help is welcome.
 
Parker @ buzztouch
buzztouch Evangelist
Profile
Posts: 1395
Reg: May 09, 2011
Pacific Grove, ...
24,500
like
09/24/11 12:07 PM (14 years ago)
So your tool bar isn't part of the html page, but something static like the nav bar? I just ask because having the buttons you want would be very easy if they were a part of the html page itself. Both buttons would just be anchor tags to the differently styled page and google. Otherwise, if you've successfully pulled this off in another project, I would take a really good look at that code in xcode and try to see if you can reproduce it in the new app. Maybe you could start by pasting the code that works here?
 
dolfinsfan23
I hate code!
Profile
Posts: 24
Reg: Jul 28, 2011
Miami
240
like
09/24/11 01:03 PM (14 years ago)
its static like the nav bar. here the code. I then linked the outlet of each bar item to its function. .h // // webViewViewController.h // webView // // Created by ******* on 9/20/11. // Copyright 2011 __MyCompanyName__. All rights reserved. // #import <UIKit/UIKit.h> @interface webViewViewController : UIViewController { IBOutlet UIWebView *webPage; } -(IBAction) buttonPressed:(id)mode; -(IBAction) buttonPressed2:(id)psalms; -(IBAction) buttonPressed3:(id)gospel; -(IBAction) buttonPressed4:(id)absolution; @end .m // // webViewViewController.m // webView // // Created by ******* on 9/20/11. // Copyright 2011 __MyCompanyName__. All rights reserved. // #import webViewViewController.h @implementation webViewViewController - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } #pragma mark - View lifecycle -(IBAction) buttonPressed:(id)mode { [webPage stringByEvaluatingJavaScriptFromString:@javascript:$('#toggler').click();]; } -(IBAction) buttonPressed2:(id)psalms { [webPage stringByEvaluatingJavaScriptFromString:@javascript:window.location.href='#Psalms']; } -(IBAction) buttonPressed3:(id)gospel { [webPage stringByEvaluatingJavaScriptFromString:@javascript:window.location.href='#Gospel']; } // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [webPage loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@http://m.davidtheprophet.com/Agpeya/First%20Hour.htm]]]; [super viewDidLoad]; } - (void)viewDidUnload { [super viewDidUnload]; // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return (interfaceOrientation == UIInterfaceOrientationPortrait); } @end
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
09/24/11 09:35 PM (14 years ago)
HI in Miami: Start with this idea... see how far you can get... All the toolbars (on the bottom of the screen, like the webview toolbar you mentioned) are created in the BT_viewUtilities.m file. Have a look at BT_viewUtilities.m > getWebToolBarForScreen method. This is the method that creates the tool bar for webviews. You'll see where it ads all the buttons to the bar before returning it. Have a look at BT_screen_webView.m file in the BT_Screens folder. Look at line 126, this is where it BUILDS the toolbar (asks the BT_viewUtilities.m file for it) then it ads it to the screen on line 117. This means you could create your own method, or modify the existing method to make your own bar. I think this is what you're asking.
 
dolfinsfan23
I hate code!
Profile
Posts: 24
Reg: Jul 28, 2011
Miami
240
like
09/25/11 04:37 PM (14 years ago)
i have spent a better part of 2 weeks trying to figure this out. I will simplify this as best as i can. How can i have a web view tool bar on the bottom have a button that when clicked goes to google?
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
09/25/11 11:55 PM (14 years ago)
I understand what you're asking....there are several ways to accomplish this, the best way is always determined by lots and lots of things. Tell me which way you think is best and I'll post a step-by-step. a) Add a button to the existing bottom toolbar that shows when you make some choices in your control panel. In other words, you have a custom URL screen already working, it already has a bottom toolbar and you want an additional button on it to open google. b) Add a button to a bottom toolbar with ONLY that button. Like you have a custom URL screen that does not show a toolbar because of the choices in the contorl panel and you want to create your own toolbar with only one button. In either case you'll end up: a) Creating a simple method to fire 'on click' of your new button. Probably something like -(void)openGoogle Next, you'll attach this method to the button you add to the toolbar. Because this is not a difficult thing in iOS development, and you mentioned that you have spent two weeks trying to figure it out, I'm guesssing you have not done much of this before. No worries, I'll walk you though it based on how you want it done (a or b above).
 
dolfinsfan23
I hate code!
Profile
Posts: 24
Reg: Jul 28, 2011
Miami
240
like
09/26/11 03:36 AM (14 years ago)
Can i use method A. And thank you so much for your responses and time, the buzz touch team really is great!
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
09/26/11 03:42 AM (14 years ago)
No worries. I'll get some code written (it's not tough) when I get to the office in a few hours. a) What app are you working with - paste the name exactly as it's listed in your control panel. b) What screen do you want this button to show up on (in the toolbar). Either ALL of the web-type-screens or post the nickname of the screen you want it so show on. c) Post 'It's OK for buzztouch to download my project for testing' - I have access to the projects but need your permission. Lastly..I'll be modifiying the actual files in your project. I'll return them to you attached to an email (only the project files I change) so be sure to save these. You'll need them if you re-download the source-code for your project. If you re-download you'll need to update the changes I included in the email. No biggie...just a reminder.
 
dolfinsfan23
I hate code!
Profile
Posts: 24
Reg: Jul 28, 2011
Miami
240
like
09/26/11 12:14 PM (14 years ago)
DTPmobile All the web type screens. It's OK for buzztouch to download my project for testing BTW, i dont really need it to open google i want it to open a this java script funtion for my html: javascript:$('#toggler').click(); I just said google because i figured i could just change it later.
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
09/26/11 11:01 PM (14 years ago)
There is a huge difference between opening (launching) a native iOS app, Safari in this case with Google open and executing some random javascript routine on a button click. You can't just execute arbitrary javascript functions on button clicks from Objective C. You can get this to work but it's a completely different concept and a totally different approach. Lets start over...start by explaing what you want to do...not kind-of what you want to do.
 
dolfinsfan23
I hate code!
Profile
Posts: 24
Reg: Jul 28, 2011
Miami
240
like
09/27/11 03:25 AM (14 years ago)
MY html file has a day/night mode it basically changes the html from white background black font to black background white font. this java script code-----javascript:$('#toggler').click();------will change the background. I have been able to replicate this in Xcode before in a tool bar (see source code above) but just have no idea how to incorporate it into a buzz touch app. Basically the i want the toolbar on the bottom to have a button linked to that javascript toggle to change the theme of my html. Thanks for your patience:)
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
09/29/11 01:33 AM (14 years ago)
No worries...really, just a matter of understanding the goal ;-) I should have a solution posted (or emailed to you) by tomorrow, waaaaaay behind. LOL
 
dolfinsfan23
I hate code!
Profile
Posts: 24
Reg: Jul 28, 2011
Miami
240
like
09/29/11 05:39 AM (14 years ago)
thank you so much...your the best:)
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
09/29/11 11:45 PM (14 years ago)
Check your email.
 
dolfinsfan23
I hate code!
Profile
Posts: 24
Reg: Jul 28, 2011
Miami
240
like
09/30/11 03:37 AM (14 years ago)
thanks dave! i dont see a button however in the simulator. do i have to add something? i didnt quite get the last part of the email
 
dolfinsfan23
I hate code!
Profile
Posts: 24
Reg: Jul 28, 2011
Miami
240
like
09/30/11 01:12 PM (14 years ago)
never mind, i had put the view utilities .m in bt screens not bt layout. Would you happen to Know how to make the button say theme? Thanks again
 
dolfinsfan23
I hate code!
Profile
Posts: 24
Reg: Jul 28, 2011
Miami
240
like
09/30/11 04:05 PM (14 years ago)
Nevermind again lol. I have now created 4 buttons but there are two problems that I've been stuck on now for an hour and a half. Problem A: How can i get two buttons on the right and two buttons on the left? Problem B: How can i hide the toolbar for my other tabs that uses a webview but doesn't need a toolbar with buttons. Thanks in advance:)
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
10/01/11 02:11 AM (14 years ago)
a) Look at this method: BT_viewUtilities.m > getWebToolBarForScreen You'll see how the buttons are added to the toolbar. Some are on the left, some are on the right. Read the code, line by line, there isn't that much in that method. b) Advanced Settings in each screen allow you to control the 'buttons' in the bottom toolbar like refresh, email document, open in native app, etc). If none of these are selected no bottom toolbar will show. If any one of them, or more than one of them is selected the bottom toolbar will show.
 
dolfinsfan23
I hate code!
Profile
Posts: 24
Reg: Jul 28, 2011
Miami
240
like
10/01/11 05:12 AM (14 years ago)
I have created 4 custom buttons for my app. based off what you did and all of them are java code. I don't have anything selected in the in the document behavior as far as a button to have the toolbar appear. the toolbar appears without needing a button from that list. Theres two ways of getting around it. A) trying to hide the toolbar altogether in the other screens. B.) getting at least different custom buttons for the other web view objects...ill post my code and I will be working to figure it out today and post anything new. Also, I'm not sure if it has anything to do with with how i got the button to say theme but maybe went about it the wrong way? if([theViewController respondsToSelector:@selector(handleCustomButtom)]){ screenUsesToolbar = TRUE; UIBarButtonItem* button = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@Theme, @Next) style:UIBarButtonItemStylePlain target:theViewController action:@selector(handleCustomButtom)]; button.style = UIBarButtonItemStyleBordered; [button setTag:108]; [buttons addObject:button]; [button release]; }
 

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.