I am working on a coverflow app. I have the app so that when a specific cover image is double tapped a new xib is pushed onto the screen. As I have it now for each image tapped the same detail view controller loads a different detail xib. so that I can have different images and text. Here is my code.
- (void) coverflowView:(TKCoverflowView*)coverflowView coverAtIndexWasDoubleTapped:(int)index{
NSLog(@"Index: %d",index);
if (index ==0){
LeafDetailViewController *detailViewController = [[LeafDetailViewController alloc] initWithNibName:@"LeafDetailViewController" bundle:nil];
[self.navigationController pushViewController:detailViewController animated:YES];
}
else if (index ==1){
LeafDetailViewController *detailViewController = [[LeafDetailViewController alloc] initWithNibName:@"LeafDetailViewController2" bundle:nil];
[self.navigationController pushViewController:detailViewController animated:YES];
}
}
I would rather just load the same detail view controller and the same detail xib. and just load the images and text that goes with the cover image chosen from an array.
Here is the array
covers = [NSArray arrayWithObjects:
[UIImage imageNamed:@"0002. LIquidambar Acalycina .jpg"],
[UIImage imageNamed:@"0003. Liquidambar Formosana.jpg"],
[UIImage imageNamed:@"0004. Liquidambar Orientalis Oriental Sweetgum1.jpg"],
[UIImage imageNamed:@"0005. Liquidambar Styraceflua Sweetgum2.jpg"],
[UIImage imageNamed:@"0023. Kalopanax Septemlobus Castor Aralia1.jpg"],
[UIImage imageNamed:@"0024. Metapanax DavidII 1.jpg"],
[UIImage imageNamed:@"0024. Metapanax DavidII 3.jpg"],
[UIImage imageNamed:@"0082. Alangium Chinense1.jpg"],
[UIImage imageNamed:@"0145. Quercus Alba White Oak1.jpg"],nil];
and here is my .h file for the detail view controller
#import
@interface LeafDetailViewController : UIViewController < UIImagePickerControllerDelegate, UINavigationControllerDelegate>{
IBOutlet UIImageView *imageView;
IBOutlet UIImageView *imageView2;
UITextView *myText;
NSArray *covers;
}
@property (nonatomic, retain) IBOutlet UIImageView *imageView;
@property (nonatomic, retain) IBOutlet UIImageView *imageView2;
@property (nonatomic, retain) UITextView *myText;
@property (nonatomic, retain) IBOutlet UIButton *takePhotoButton;
@property (nonatomic, retain) NSArray *covers;
-(IBAction) getPhoto:(id) sender;
@endcan anyone help me to do this. I am a rather newbie at this and would really appreciate some help.
Replies
2. In viewWillAppear, set this UIImage to the appropriate image view.
3. Now when you allocate LeafDetailViewController, retrieve the selected image using NSArray's objectAtIndex: method passing in "index" (assuming you are doing this from coverflowView:(TKCoverflowView*)coverflowView coverAtIndexWasDoubleTapped:(int)index.
4. Set the LeafDetailViewController's image property with the image you just got from the array.
New app - See screenshots and details at www.globaclock.com.
If you want to
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeThis is what I put in
- (void) coverflowView:(TKCoverflowView*)coverflowView coverAtIndexWasDoubleTapped:(int)index{
LeafDetailViewController *detailViewController = [[LeafDetailViewController alloc] initWithNibName:@"LeafDetailViewController" bundle:nil];
detailViewController.imageView= [covers objectAtIndex:index];
[self.navigationController pushViewController:detailViewController animated:YES];
}
and this is in the viewDidLoad
- (void)viewDidLoad
{
[super viewDidLoad];
imageView.image = [UIImage imageNamed: @"index"];
}
I know this isn't right
could you please help me.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeOnce you've read that, do the 1st step and post the header file of LeafDetailViewController.
New app - See screenshots and details at www.globaclock.com.
If you want to
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- (void)viewDidLoad
{
[super viewDidLoad];
UIImage *image = [[UIImage alloc] init];
self .imageView.image =image;
}
I noticed now that apple doesn't let you release so I left those out.
I hope I did this ok.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeNew app - See screenshots and details at www.globaclock.com.
If you want to
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome-(void) viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
UIImage *image = [[UIImage alloc] init];
self .imageView.image =image;
}
before
-(void) viewDidLoad
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome