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

jtbullet

macrumors member
Original poster
Jan 19, 2009
30
0
Hi. I am reading about the automatic forward back buttons that rely on the list in uiwebview to hold the urls. Is there a way to prepopulate the list? What i mean is this: My html page has a single jpeg on it. It is the first page of the sequence. The forward button has nothing in its memory at this point. If i wsa on page 2, i could move back to page one, since it would be in memory, so i understand how backwards works, but how do you use forward, since nothing is in memory at the beginning? I know this is probably a weird question, but thanks!
Jarrett
 
I don't think there's any way to preload the list. I haven't used that feature so I'm not positive. If calling the various load... methods would add to the list then maybe it would be possible. You could load all the pages one after the other and then the list would be filled.

Regarding your question, how do you use forward? There's only a single list and it has a cursor pointing to the current page. If you go to three pages the list has this contents: 1, 2, 3 and the cursor is 3. If you goback the list doesn't change but the cursor is now 2. If the cursor is at the end of the list then you can't go forward. If the cursor is in the middle of the list then you can go forward.

Same for going back. If cursor is at 1 then you can't go back. If it's at any other value then you can go back.
 
I must be misunderstanding then. To actually go forward to a page you had not visited would seem like you needed to hit a seperate forward button. It almost seems like the code is redundant. If you code your forward button to go to page 2, the page advances to page 2, but when you back up, you are on page 1, but you already have the button to go forward, so there isnt any use for the forward function that calls the list, unless accessing the cache is faster than rerendering the html each time.

Question: What would code to advance from one html page to another look like? Is it something you can manually link up in interface builder?
Thanks,
jarrett
 
On a normal html page there are links in the page that go 'forward.' There can of course be any number of links in a given page. The forward/backward list is the links that you've already traversed. So they're not the same.

Every web browser implements a forward/backward list in this way. Of course normally the forward/backward list isn't pre-populated as you seem to be attempting to do.
 
Yes I understand its unconventional. It may just be better for me to manually link forward and back buttons that i make myself, since i already know html pretty well. I could gain the real estate from the bottom of the screen back as well, even though theyd be taken up by the buttons anyway. Now I understand that the forward back list is a relative list, not an absolute list. I.e. if it happened that i visited page 3, then page 12, and hit the back button, i would move to page 3, not 11. The forward back list is basically a history control, no history, no action to call upon.
 
Right, the builtin forward/back is a history of where you've gone.

If you have a set of pages like pages in a book that are meant to be traversed in order you can do things a couple ways. Either have forward/backward links in each page or have forward/backward buttons outside the page. These buttons outside the page aren't related to the builtin forward/back list. You just use your own logic to choose what forward/back means and then load a new page with one of the load... methods.

If your pages aren't going to look like web pages, that is not have any links in them otherwise, then I would use the external buttons, probably on a toolbar at the bottom of the screen.
 
Assuming I am using the external buttons with no links on the page, is it a matter of setting the button to look at what image you are currently on, and saying get image number X+1? Is this the kind of thing I am heading into? Thats fine if I am, just making sure I have my head on right.
While we are at it, is there any good reason to reference html at all, why not just pull the jpg itself. I had hoped to avoid coding this part using xcode, but since it looks inevitable, I guess I should just do the whole thing this way.
 
Assuming I am using the external buttons with no links on the page, is it a matter of setting the button to look at what image you are currently on, and saying get image number X+1?

That's pretty much it.

Are you planning on only displaying jpegs? I'm not sure there's a real reason to use a webview for that. You can use a UIImageView for that.

I would use a UIWebView for display of a page that has multiple styles of text in it or text and images or for a page that must have links in it. iPhone OS doesn't have a good way of displaying styled text, except for UIWebView.
 
I don't know anything much about web apps so I can't advise you on that.

Writing an app to just display one jpeg after another wouldn't be hard. I would almost certainly use an image view rather than the webview. You could probably have your toolbar be transparent or fade out unless a touch goes near it so you can use the full screen or most of it.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.