how to reload a view again and again - iphone

hi i am a new iphone programmer
i am creating a imagedisplay type application where i have to display images on a view and by presssing a next button a new image should appear on same view (i am using database)...
therefore i need to reload my current view again and again...each time when i click that button....
i tried some suggesion which are given on this website but not satisfied because many of them are based on timer...
please help.....

May be I have missed something in your question. But why you need to reload the entire view? You are using an UIImageView to display your image, right? And you are not showing any kind of scroll, but only a next button, right? Then why don't you just set the image property of UIImageView when the button is tapped.
// in button handler
myImageView.image = [UIImage imageNamed:#"new_image.png"];

Perhaps you could use a paged UIScrollView with three uIImageViews and always have the previous, current and next image loaded. This way when the user hits next, it scrolls animated to the next image. When page 3 is loaded, it programmatically sets the second image view as the desired next image, sets the image you came from on the first image view, and sets the scroll view non-animated to page two and loads the next image in the third image view.
Sounds complicated but basically you are giving the appearance of an infinite scroller but only pulling one image at a time except for initial load of three.

You could try looking at the "PageControl" Example Project in the XCode Documentation. It should give you a good starting point.

Related

I want to load second view with given frame size

I try to load Second view in MainView with define frame size but don't need to see component of second view. I set size till it weel be appear.
-(IBAction)displayNewView:(id)sender {
[mrView setFrame:CGRectMake(0,150,320,50)];
[self.view addSubview:mrView];
}
i dont want to see second button.
Hey, I solved this issue by checking "Clip Subviews".
It will crop rest of the part of view which will not display.
Nice Question with basic issue.
Thanks.
If you have Button on Second View. Then It'll display on View when you are loading second view on Main View. Because it's part of Second View.

Thumbnail images - Click to load image details

I want to display like 9 thumbnail (arranged in 3x3) images in a View Controller.
Then when I touched on one of the thumbnail images, it loads another View Controller,
to display the details of this specific image, like date taken, description of the photo.
I have checked out Three20 project, but im not sure if this is the only way to go?
Are there other ways to do this without using the Three20 project?
Thanks!
There are many ways to do that.
the simplest ways I can think of are:
create a view that holds 9 UIImages and add a gesture recognizer to the views, create a view to hold the deatils and call it each time a view is clicked.
create 9 buttons and set the images to the buttons, reate a view to hold the deatils and call it each time a button is clicked.
pretty strait forward.
good luck
shani

UIButton Game character selection to UIImageView animation

I am almost at the end of coding my kids educational application, woohoo!.
But... Im stuck on something.
When app loads i have my main view. It has 4 buttons for flipviews(each with ten views of content) and 4 buttons for character selection(an image that will follow you through every screen of content).
Problem is im unsure on how to link UIButton selection to UIImage display in multiple views. I want the user to choose a character button and then continue to the flipviews and in the views the image displayed should be the one that they have selected on the main view. So everytime they return to the main view they can change the character that will follow them around the app.
Any thoughts, help or code would be much appreciated!
Thank You
Alex
Make a new object, a subclass of UIImageView, which has a -setImage method. Once you set the image, then where ever you embed that object, it will display the same image. You could even have that subclass view have a score displayed next to it, or a name or other stats, so as you go from one screen to another, you have all that info follow you around with the image. No need to create labels in all the screens for global info like that.
In summary:
make a new subclass of UIView or UIImageView in Xcode using the New File... menu. You would do new UIView if you will have other items than just an image.
add methods that allow you to set the image, update text stats etc.
BONUS: you can make the class handle taps, so if a user taps the image, you could do something like provide help or run a cute little animation
embed that object in any screens you wish. Keep in mind that you can have that view be sized differently in each screen using transforms. Cool, no?
that's pretty much it!
Good luck!

how to add text and images together

I'm developing a notebook based application. it consists of notes and images also.
I'm unable to find the best way of coding to add images and text together. it is also editable, so I'm getting confused whether to take scroll-view or text view. If I take scroll-view there is no editable option. if I take text view we can't change frames of the image .
Solved as follows. Taken Scrollview, in that managing size of the textview & inserting image with Specified size. Like textview,image,tetxview, image and goes on...
Thanks for all your support to solve the issue.
You can use a TableView. Put the image in a custom cell with the view as an ImageView.
Put a UITextField as the second cell for text note.
Alternatively, you can use a view swap method, where the text view is on the back of the image by clicking on an "Info" button to use the Flip transition and show the note. The facebook app does this now for "Comments" on photos.

splash screen like tap tap revenge 3

thank you for taking your time to read this message. I hope you are able to answer my question.
I would like to add a splash screen to an existing project similar to that of tap tap revenge 3.
it basically shows one screen for 2 seconds then another for 2 seconds and then it just shows the menu straight away.
Can anyone tell me how i would be able to create something like that?
thanks
.
Obviously opinions on splash screens vary. However, to do what TTR does is pretty simple; have a single Default.png file for your first screen. Then, make the top view controller you load at startup a simple image, and that's your second screen.
The trick is too offload as much of your startup code as possible, and defer it to after the initial launch. Anything done= between startup and the end of applicationDidFinishLaunching: will be done while your Default.png screen is shown. Use -performSelector:withObject:afterDelay: to defer 'expensive' calls, so that you can quickly get to your second splash screen.
its very simple. i've just accomplished this and it works exactly the same way that the tap tap revenge loading screen does.
To load 2 different screens one after another before showing the main menu you do this.
1) create a nib file place a UIButton that covers the whole screen then connect it to an outlet.
2) in the viewDidLoad method i made sure that the UIButton's image background property was set to image1 then after 1.5 seconds change it to image2 with a timer.
now the tap tap revenge loading screen allows you to skip those two loading screens by tapping on the screen. so basically create a function so that when the user taps on the screen (which essentially is a huge button that covers the width and height of the screen) it would change to UIButtons image background property to image2. If clicked again it would load a new nib file for the main menu. voila job done.
so either way if you dont tap on the screen (the uibutton) then because of the timer the application will show image1, then change the UIButton's image automatically to image2 after 1.5 seconds then again after another 1.5 seconds (3 seconds in total) the application would load the mainMenuView nib file.
obviously when you click the button once it should change to image2 but then how do you get the image to change to image2 when the same function is called:
well i have a counter which will incremement in 1 when the function is called.
so at startup that value would be 0. so when the user taps on the button to quikly skim past the loading screen the value would change to 1 and the image would change to image2.
when the user clicks on the button again to skip from image2 to the loading screen the same function would be called that changes the image but would check the counter to see if it is in value 1 and if it is then that its already on image2 so then just load the screen.
its as simple as that. it works very well.
If there is an easier way to do this do let me know. thanks
Pk