Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 01-11-2012, 11:01 AM   #1 (permalink)
Registered Member
 
Join Date: Sep 2011
Posts: 7
andrihardware is on a distinguished road
Red face HELP! UITableView (Detail View)

I'm new on xcode so I have little bit confuse.

I developing apps with UITabBar, UINavCont, and of course UITableView,
I know how to build a detail view, but I get confuse when situation like this :

Usually, I get tutorial how to make Detail view like this :

Item 1 -> Cell -> Detail View

here the tutorial :

UITableViews: Pushing a detail view using NSDictionaries - YouTube

But I want to make like this :

Item 1 -> Detail View

can anyone help me?
andrihardware is offline   Reply With Quote
Old 01-11-2012, 11:41 AM   #2 (permalink)
Registered Member
 
Music Man's Avatar
 
Join Date: Oct 2009
Location: UK
Posts: 81
Music Man is on a distinguished road
Default

Quote:
Originally Posted by andrihardware View Post
I'm new on xcode so I have little bit confuse.

I developing apps with UITabBar, UINavCont, and of course UITableView,
I know how to build a detail view, but I get confuse when situation like this :

Usually, I get tutorial how to make Detail view like this :

Item 1 -> Cell -> Detail View

here the tutorial :

UITableViews: Pushing a detail view using NSDictionaries - YouTube

But I want to make like this :

Item 1 -> Detail View

can anyone help me?
It's the same as the video but you just need one less UITableView.

You said the video is -> item 1, cell, detail view - let's talk about what they actually are:

UITableView, UITableView, UIViewController(to control UIView).

All you need to do is to have 1 UITableView and 1 UIViewController (with view).

Just realised, go to the tutorial section and look for BrianSlick's table view series, that should help you.
Music Man is offline   Reply With Quote
Old 01-11-2012, 12:05 PM   #3 (permalink)
Registered Member
 
Join Date: Sep 2011
Posts: 7
andrihardware is on a distinguished road
Default

Quote:
Originally Posted by Music Man View Post
It's the same as the video but you just need one less UITableView.

You said the video is -> item 1, cell, detail view - let's talk about what they actually are:

UITableView, UITableView, UIViewController(to control UIView).

All you need to do is to have 1 UITableView and 1 UIViewController (with view).

Just realised, go to the tutorial section and look for BrianSlick's table view series, that should help you.
Thank you for advice

But can you tell me how to use only 1 UITableView?
I write the code same as like the video

Code:
#import "FingerfsTableView.h"
#import "FingerfsDetailView.h"

@implementation FingerfsTableView

@synthesize fingerfsInt;

- (id)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle:style];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)dealloc
{
    [aboutArray release];
    [youthArray release];
    [playArray release];
    [blogArray release];
    [super dealloc];
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [self makeData];
    [super viewDidLoad];

    // Uncomment the following line to preserve selection between presentations.
    // self.clearsSelectionOnViewWillAppear = NO;
 
    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
-(void) makeData {
    
    aboutArray = [[NSMutableArray alloc] init];
    youthArray = [[NSMutableArray alloc] init];
    mefpArray = [[NSMutableArray alloc] init];
    playArray = [[NSMutableArray alloc] init];
    blogArray = [[NSMutableArray alloc] init];
    
    [aboutArray addObject:[[NSMutableDictionary alloc]
                           initWithObjectsAndKeys:@"English", @"title", @"Welcome", @"text", nil]];
    [aboutArray addObject:[[NSMutableDictionary alloc]
                           initWithObjectsAndKeys:@"Indonesia", @"title", @"Selamat Datang", @"text", nil]];
    
    [youthArray addObject:[[NSMutableDictionary alloc]
                           initWithObjectsAndKeys:@"English", @"title", @"Welcome", @"text", nil]];
    [youthArray addObject:[[NSMutableDictionary alloc]
                           initWithObjectsAndKeys:@"Indonesia", @"title", @"Selamat Datang", @"text", nil]];
    
    [playArray addObject:[[NSMutableDictionary alloc]
                           initWithObjectsAndKeys:@"English", @"title", @"Welcome", @"text", nil]];
    [playArray addObject:[[NSMutableDictionary alloc]
                           initWithObjectsAndKeys:@"Indonesia", @"title", @"Selamat Datang", @"text", nil]];
    
    [mefpArray addObject:[[NSMutableDictionary alloc]
                          initWithObjectsAndKeys:@"English", @"title", @"Welcome", @"text", nil]];
    
    
    [blogArray addObject:[[NSMutableDictionary alloc]
                           initWithObjectsAndKeys:@"English", @"title", @"Welcome", @"text", nil]];
    [blogArray addObject:[[NSMutableDictionary alloc]
                           initWithObjectsAndKeys:@"Indonesia", @"title", @"Selamat Datang", @"text", nil]];
    
}
- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
}

- (void)viewDidDisappear:(BOOL)animated
{
    [super viewDidDisappear:animated];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
#warning Potentially incomplete method implementation.
    // Return the number of sections.
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
#warning Incomplete method implementation.
    // Return the number of rows in the section.
    if (fingerfsInt == 0) 
        return [aboutArray count];
    if (fingerfsInt == 1)
        return [youthArray count];
    if (fingerfsInt == 2)
        return [playArray count];
    if (fingerfsInt == 3)
        return [mefpArray count];
    if (fingerfsInt == 4)
        return [blogArray count];
    
    [self.tableView reloadData];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }
    
    // Configure the cell...
    if (fingerfsInt == 0)
        cell.textLabel.text = [[aboutArray objectAtIndex:indexPath.row] objectForKey:@"title"];
    if (fingerfsInt == 1)
        cell.textLabel.text = [[youthArray objectAtIndex:indexPath.row] objectForKey:@"title"];
    if (fingerfsInt == 2)
        cell.textLabel.text = [[playArray objectAtIndex:indexPath.row] objectForKey:@"title"];
    if (fingerfsInt == 3)
        
    if (fingerfsInt == 4)
        cell.textLabel.text = [[blogArray objectAtIndex:indexPath.row] objectForKey:@"title"];
    
    [cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
    return cell;
}

/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Return NO if you do not want the specified item to be editable.
    return YES;
}
*/

/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source
        [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
    }   
    else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    }   
}
*/

/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
{
}
*/

/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Return NO if you do not want the item to be re-orderable.
    return YES;
}
*/

#pragma mark - Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    FingerfsDetailView *fingerfsDetail = [[FingerfsDetailView alloc] initWithNibName:@"FingerfsDetailView" bundle:nil];
    
    if (fingerfsInt == 0) 
    {
        fingerfsDetail.fingerfsLabelString = [[NSString alloc] initWithString:[[aboutArray objectAtIndex:indexPath.row] objectForKey:@"title"]];
        fingerfsDetail.fingerfsTVString = [[NSString alloc] initWithString:[[aboutArray objectAtIndex:indexPath.row] objectForKey:@"text"]];
        fingerfsDetail.title = [[aboutArray objectAtIndex:indexPath.row] objectForKey:@"title"];
    }
    if (fingerfsInt == 1) 
    {
        fingerfsDetail.fingerfsLabelString = [[NSString alloc] initWithString:[[youthArray objectAtIndex:indexPath.row] objectForKey:@"title"]];
        fingerfsDetail.fingerfsTVString = [[NSString alloc] initWithString:[[youthArray objectAtIndex:indexPath.row] objectForKey:@"text"]];
        fingerfsDetail.title = [[youthArray objectAtIndex:indexPath.row] objectForKey:@"title"];
    }
    if (fingerfsInt == 2) 
    {
        fingerfsDetail.fingerfsLabelString = [[NSString alloc] initWithString:[[playArray objectAtIndex:indexPath.row] objectForKey:@"title"]];
        fingerfsDetail.fingerfsTVString = [[NSString alloc] initWithString:[[playArray objectAtIndex:indexPath.row] objectForKey:@"text"]];
        fingerfsDetail.title = [[playArray objectAtIndex:indexPath.row] objectForKey:@"title"];
    }
    
    //Problem here
    
    if (fingerfsInt == 3) 
    {
        fingerfsDetail.fingerfsLabelString = [[NSString alloc] initWithString:[[mefpArray objectAtIndex:indexPath.row] objectForKey:@"title"]];        
        fingerfsDetail.fingerfsTVString = [[NSString alloc] initWithString:[[mefpArray objectAtIndex:indexPath.row] objectForKey:@"text"]];
        fingerfsDetail.title = [[NSString alloc] initWithString:@"title"];
    }
    if (fingerfsInt == 4) 
    {
        fingerfsDetail.fingerfsLabelString = [[NSString alloc] initWithString:[[blogArray objectAtIndex:indexPath.row] objectForKey:@"title"]];
        fingerfsDetail.fingerfsTVString = [[NSString alloc] initWithString:[[blogArray objectAtIndex:indexPath.row] objectForKey:@"text"]];
        fingerfsDetail.title = [[blogArray objectAtIndex:indexPath.row] objectForKey:@"title"];
    }
    
    [self.navigationController pushViewController:fingerfsDetail animated:YES];
    [fingerfsDetail release];
}

@end
I still confuse with this even with BrianSlick's tutorial, please help
andrihardware is offline   Reply With Quote
Old 01-14-2012, 02:43 PM   #4 (permalink)
Registered Member
 
Music Man's Avatar
 
Join Date: Oct 2009
Location: UK
Posts: 81
Music Man is on a distinguished road
Default

I have quickly written a simple table view program which has a table view as the main view and another view as the detail view.
This is just using a simple array to provide the data.

It's a simple program but the focus is on only having one table view and one detail view.


ExampleTable.zip - mediafire link
Music Man is offline   Reply With Quote
Old 01-14-2012, 09:06 PM   #5 (permalink)
Registered Member
 
Join Date: Sep 2011
Posts: 7
andrihardware is on a distinguished road
Default

Hi music man!
Thank you , It's work
andrihardware is offline   Reply With Quote
Reply

Bookmarks

Tags
nsdictionary, uitableview

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 387
10 members and 377 guests
7twenty7, Atatator, buggen, guusleijsten, j.b.rajesh@gmail.com, QuantumDoja, sacha1996, Sami Gh, tim0504, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,674
Threads: 94,122
Posts: 402,907
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Atatator
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:38 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0