开发者

Questions about a drill-down menu app with different types of custom cells

开发者 https://www.devze.com 2022-12-14 01:01 出处:网络
Let me first say that by NO MEANS I am a programmer, just know the basics and just started messing with iPhone SDK. I am developing a simple app to simulate security settings for a class project, but

Let me first say that by NO MEANS I am a programmer, just know the basics and just started messing with iPhone SDK. I am developing a simple app to simulate security settings for a class project, but have encountered issues even though I have found code for most of the things I want done. The main issue I have is that I don't really get how to integrate them.

In any case, the application (once running) shows 3 main options in a grouped style table view. When selecting the first option, it should take you down 1 level and be able to select an item from the list and show the checkmark for the selected item. The second option, I wanted to recreate the passcode window from the iPhone's settings (not done yet). And when the third option is selected, a list of "Apps" (I'm just throwing names there) should appear with a small icon for each and a ON/OFF switch as well. Like I said, it will be all just a simulation and all I want is for it to show properly, I am not expecting any action from the selections.

I have some code in comment, that I found and relates to what I want. I know there are variables there that don't relate to my project. I have attached my whole Project folder, here:

http://rapidshare.com/files/319884407/Secure开发者_如何学运维It.zip.html

I appreciate any help anyone can give me.


You're describing a fairly standard table-driven app. I don't have the inclination to download and parse through your zipped source code, and you haven't asked a specific question, but I'll try and help anyway.

Basically, with these kinds of apps, each different screen is a separate .xib containing its own UITableView. Since you already have your "root" screen running, you're already familiar with this pattern. Implementing the behaviour for your first option involves detecting when a cell has been tapped, determining which cell was tapped, and then using the navigation controller to pop the next view on the stack while simultaneously clearing the selection (to follow Apple's UI guidelines).

Here's the basic pattern:

#pragma mark Table Delegate Methods

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if ([indexPath row] == 0)
    {
        FooViewController* fooViewController = [[FooViewController alloc] initWithNibName:@"FooView" bundle:nil];
        [self.navigationController fooViewController animated:YES];
        [fooViewController release];
    }
    else if ([indexPath row] == 1)
    {
        BarViewController* barViewController = [[BarViewController alloc] initWithNibName:@"BarView" bundle:nil];
        [self.navigationController barViewController animated:YES];
        [barViewController release];
    }

    [tableView deselectRowAtIndexPath:indexPath animated:YES]; // Conform to Apple human-interface guidelines (Table View Programming Guide for iPhone OS)
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号