Question

I am trying to push data to SDWebImageDataSource file and push view to SDWebImageRootViewController with the code below. But I have a problem that imageLink(string) becomes null in the next SDWebImageDataSource but it push view to SDWebImageRootViewController.

Where would be my issue?

- (void)showSDWebImageView
{
  SDWebImageDataSource *imageController = [[SDWebImageDataSource alloc] init];
  imageController.imageLink = string1;
  NSLog(@"imagelink are: %@", imageController.imageLink);
  [imageController release];


  SDWebImageRootViewController *newController = [[SDWebImageRootViewController alloc] init];
  [[self navigationController] pushViewController:newController animated:YES];
  [newController release];
}

SDWebImageDataSource.h

@property (nonmatic, retain) NSString *imageLink;

SDWebImageDataSource.m

@synthesize imageLink;
Was it helpful?

Solution

Better you can use method to pass the data, like the following.

SDWebImageDataSource *imageController = [[SDWebImageDataSource alloc] init];
[imageController setImageLink:string1];

In you SDWebImageDataSource class, you can get the data from that method,

-(void)setImageLink:(NSString *)imageLinkStr
{
   imageLink = imageLinkStr;
}

hope it will help you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top