views:

194

answers:

2

Hi,

I'm new to iPhone Development and I did some examples and seen code and code and more code but I still can't get the

when the user taps here show this view using this animation, and go back after (user taps a back button)

I did some Tab Bar examples, Utility examples, etc but when I start a project from scratch the code never does what I want :-/

every time I create a View (xib) I also create the controller (h and m files), as all examples are like this, and I have no idea if I can only create 4 Views and just have one controller :-(

when a user taps a UITableCell how can I load a new view using an animation? and how can I go back to the UITableCell the user was?

kind'a (in C#)

myNewForm f = new myNewForm();
f.show();

...

this.Close();

If someone can share some knowledge or a tutorial or a screencast, I will greatly appreciate

Thank you!

+1  A: 

Tap a cell and show a new view, if your table view has a UINavigationBar:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.row == myRow) {
        MyViewController *vc = [[MyViewController alloc] init];
        [self.navigationController pushViewController:uvc animated:YES];
        [vc release];
    }
}

Then the user can tap back as well. You can present modally as well, but would need to implement a way to return to the table view, by using:

[self presentModalViewController:vc animated:YES];

But the simplest base case is this, which you can see used in any template app's AppDelegate:

[window addSubview:vc.view];

Remember that the OS is doing a lot for you, including teaching you about MVC by encouraging the creating of controller classes.

Paul Lynch
and if it's just UIView's with no Navigation? HUm... maybe I should stick with Navigation for my first projects :-/ it's sooooo easy in C# :D
balexandre
It's easy in iPhone too. But you have lots of options given you by the OS for different ways to do things. Guess I'll edit my answer for you.
Paul Lynch
A: 

You want to read about UINavigationController. Maybe also read the "View Programming Guide for iPhone OS", all available at http://developer.apple.com.

Jean-Denis Muys