Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

alexpja

macrumors member
Original poster
Mar 22, 2010
81
0
Hi there, I am making a newsreader application where I want to have a button on the toolbar on the bottom of my screen to take me back to my website... how can I do this? :confused: I have the back, forward, refresh, and stop buttons all good and working, just need this button :/
 

hayesk

macrumors 65816
May 20, 2003
1,460
101
What problem are you having?

Add a button, set the target and action to a method on your view controller that tells your web view to load the URL of your home page.
 

alexpja

macrumors member
Original poster
Mar 22, 2010
81
0
What problem are you having?

Add a button, set the target and action to a method on your view controller that tells your web view to load the URL of your home page.

Here's the problem... I am a total newbie and do not like to read books, and cannot find anything like this on Google :S so I'd love any help I can get o_o
 
Last edited:

alexpja

macrumors member
Original poster
Mar 22, 2010
81
0
What problem are you having?

Add a button, set the target and action to a method on your view controller that tells your web view to load the URL of your home page.

What did he mean... D:
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
Here's the problem... I am a total newbie and do not like to read books, and cannot find anything like this on Google :S so I'd love any help I can get o_o
First, of all: welcome! we were all newbies at some point. There's nothing wrong with that.

If you ask for specific help, you'll get more support. Just realize that probably very few here are going to just give you a solution you can copy-and-paste.

If you don't like to read books, fine. But if you want to become a good programmer, you're going to want to be comfortable reading, because it will be quicker for you to be able to find and interpret pre-existing information rather than seeking help from others constantly. Just some advice as you start out.

So, if books aren't for you, what is? That will help us tailor our answers to an approach you prefer.
 

alexpja

macrumors member
Original poster
Mar 22, 2010
81
0
...
So, if books aren't for you, what is? That will help us tailor our answers to an approach you prefer.

Well, I am making an app where you can view through a selection of websites to read, and I need a button on the toolbar where the back, forward, refresh, and stop buttons are to link back to the original website where they can go through the selection again without having to press back too much... I need a simple, copy-n-paste code since I will not be able to combine this piece of code, and this piece of code to make this piece... etc. e.e
 

alexpja

macrumors member
Original poster
Mar 22, 2010
81
0
Sorry, I couldn't be more helpful but I wanted to wish you well in your quest. I suspect you're gonna need it. ;)

Of course I am... since there is no one who can help me with this :/ Can you? o:
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
Can you? o:
Perhaps. As you can tell, I'm not about to give you copy-and-paste code. As robbieduncan likes to say, "That's not programming". But if there is some other approach to learning besides books that you prefer, please let us know and we'll see what we can do.

Also, make sure you've stopped by the Guides and Stickies at the top of this very forum.
 

alexpja

macrumors member
Original poster
Mar 22, 2010
81
0
Perhaps. As you can tell, I'm not about to give you copy-and-paste code. As robbieduncan likes to say, "That's not programming". But if there is some other approach to learning besides books that you prefer, please let us know and we'll see what we can do.

Searched through Google, found nothing... Will look at that sticky... Thanks anyway v.v

EDIT:

If I'm understanding your problem correctly, you want each of the buttons on the left to cause the web view on the right to load a particular URL. If that's the case, one reasonable way to do that is to create a view controller for this view (you may have done that already) which has an action (or actions) to which you would connect each button.

The view controller would have an outlet to the web view so it can send messages to that view to load URLs as needed.

Assuming I'm understanding the question correctly...

This is what I meant... except I do not know what the view controller is and I do not know how to work with it, I know how to make actions and outlets though...
 
Last edited:

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
...except I do not know what the view controller is...
If you don't know what a view controller is I think it's time to step away from the real coding and go learn the basics of iPhone programming. Without a good foundation of the fundamentals, it is going to be more difficult to move forward with even fairly simple tasks like you are attempting to do. In other words, you must learn to walk before you can run.
 

alexpja

macrumors member
Original poster
Mar 22, 2010
81
0
If you don't know what a view controller is I think it's time to step away from the real coding and go learn the basics of iPhone programming. Without a good foundation of the fundamentals, it is going to be more difficult to move forward with even fairly simple tasks like you are attempting to do. In other words, you must learn to walk before you can run.

Okay e.e.... Now where can I find the basics of iOS programming that are simple enough for someone like me (I do not even understand the iOS Reference Library).... e.e
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
Well, you still haven't told us what learning style you prefer (all we know is what you don't like: books), so it's hard to make recommendations. Was there nothing in the FAQ that appealed to you?
 

alexpja

macrumors member
Original poster
Mar 22, 2010
81
0
Well, you still haven't told us what learning style you prefer (all we know is what you don't like: books), so it's hard to make recommendations. Was there nothing in the FAQ that appealed to you?

The learning style I prefer is more like... online tutorials that are understandable and easy to learn from... not like the iOS reference library :S

In the FAQ (which I think you meant is the guides and stickes on top of the forum), there was nothing that appealed to me... and also, I am trying to get this done as soon as possible so :S and sorry for any misunderstandings when reading my replies, Polish is my first language :3

Also, with books (I read books all the time, just hate them for learning resources) I cannot concentrate on what I am reading and it is harder for me to follow with what the book says...
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
The learning style I prefer is more like... online tutorials that are understandable and easy to learn from... not like the iOS reference library :S

In the FAQ (which I think you meant is the guides and stickes on top of the forum), there was nothing that appealed to me... and also, I am trying to get this done as soon as possible so :S and sorry for any misunderstandings when reading my replies, Polish is my first language :3
The iPhone Developer FAQ (which is a Sticky of this forum) contains a link to some online tutorials. Did you give them a look? Also, I've found the iCodeBlog tutorials to be quite helpful (although the oldest articles on the simplest things may be somewhat out-of-date now).

As for trying to get this done as soon as possible, what is the reason behind the urgency? Do you have a deadline or something?
 

nickculbertson

macrumors regular
Nov 19, 2010
226
0
Nashville, TN
in your .h
Code:
- (IBAction)mySite;

in your .m
Code:
- (IBAction)mySite { 
	[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.youtube.com"]]];
}


add a bar button item in interface builder and connect it to mySite action.

Nick
 

alexpja

macrumors member
Original poster
Mar 22, 2010
81
0
in your .h
Code:
- (IBAction)mySite;

in your .m
Code:
- (IBAction)mySite { 
	[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.youtube.com"]]];
}


add a bar button item in interface builder and connect it to mySite action.

Nick

Thank you so much! Thanks for helping me... :D

EDIT: Should I place it between:
Code:
@interface WebAppDelegate : NSObject <UIApplicationDelegate> {
    UIWindow *window;
	UIWebView *webView;
}
? (.h) and where in my .m?

As for trying to get this done as soon as possible, what is the reason behind the urgency? Do you have a deadline or something?

Yes.
 

alexpja

macrumors member
Original poster
Mar 22, 2010
81
0
How did you get the "back, forward, refresh, and stop buttons all good and working"? Maybe try the same approach?

Well, I went into IB, and pressed the button. Then, CTRL-clicked the UIWebView, and clicked the action for that button. I cannot do that for my button, so please just help me here and stop pointing me to FAQs and tutorials when they will not help my problem e.e
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.