Subscribe ( )

iPhone Programming Tutorials


 

Forum

You must be logged in to post Login Register

Search 

Linking a view to a specific table cell

User Post

11:29 am
January 12, 2009


jameswatts1990

Noob

posts 2

1

Ok, I've been puzzling over this all day now, used examples from tutorials, books etc. but I can't seem to get it right.

Could anyone tell me how to link a view to a cell in a table.

For my example table below, say I were to click John, how could I link it so that it would lead to a specific page about john, maybe a photo, information etc. In this example it would be very similar to the address book app.

John > Specific page about john > button to go back and select another

Bob

Foo

Bar


Thanks in advance to anyone who is able to help me here :)


4:52 am
January 31, 2009


jitesh61

iCoder

posts 12

2

Hi,


If u want to add new view to the existing row than u should try this..

I hope U are following this tutorials and u have made u r application like Fruits……..

:)

— create new view using Interface Builder .. suppose … InformationViewController

and add this to u r current project ….
create InformationViewController.h and .m by using UIViewController subclass
now ….
goto RootViewController.h and add the following lines…. i. e.
#import “InformationViewController.h”
in the interface
{
InformationViewController *infoView;
}
@property (nonatomic, retain) InformationViewController *infoView;
now in the .m file 
add 
#import “InformationViewController.h”
@synthesize infoView;
Now, find the method 

 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

in that write following code …….  beware of names which I used at here …. u might have used another 

FruitAppDelegate *appDelegate = (FruitAppDelegate *) [[UIApplication sharedApplication] delegate];

 

Fruit *fruitArray = (Fruit *) [appDelegate.fruitArray objectAtIndex:indexPath.row];

 

if(indexPath.row == 0) // for selecting the first row of u r cell (like array)

{

if(self.infoView == nil)

{

InformationViewController *viewController = [[InformationViewController alloc] initWithNibName:@”InformationViewController” bundle:[NSBundle mainBundle]];

self.infoView = viewController;

[viewController release];

}

 

[self.navigationController pushViewController:infoView animated:YES];

self.infoView.title = [fruitArray strFruit];

}

Hope u get what u wanted …….. :)

3:24 am
February 18, 2009


jameswatts1990

Noob

posts 2

3

Not tried this yet but looks very in-depth and should be quite helpful! :) Thanks for taking the time to help! 

Search 

About the iCodeBlog forum

Most Users Ever Online:

44


Currently Online:

2 Guests

Forum Stats:

Groups: 2

Forums: 6

Topics: 419

Posts: 893

Membership:

There are 934 Members

There has been 1 Guest

There are 2 Admins

There is 1 Moderator

Top Posters:

bobcubsfan – 54

crazyiez – 30

Uhu – 17

AdeC – 17

Nick – 15

jitesh61 – 12

Administrators: Brandon (88 Posts), Collin (0 Posts)

Moderators: VertigoSol (26 Posts)



©   

  • Posted by on 6 Aug 2008 in Uncategorized
  •   |  
  •   |  
  •   |  
  • Comments Off

Comments are closed.