Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try this code, may it will solve your issue. the problem is that you are setting the properties after pushing the controller which is wrong. try the below code:</p> <pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:NO]; TrafficDetailViewViewController *trailsController = [[TrafficDetailViewViewController alloc] init]; trailsController.trafficImage = [thumbnails objectAtIndex:indexPath.row]; trailsController.LocationLable = [tableData objectAtIndex:indexPath.row]; //transfering control to detail view [[self navigationController] pushViewController:trailsController animated:YES]; } </code></pre> <p><strong>EDIT</strong></p> <p>.h File in .m File</p> <p>Add the synthesizer if you are not adding yet.</p> <pre><code>@synthesize trafficImage = _trafficImage; @synthesize LocationLable = _LocationLable; </code></pre> <p>Also Edit one more thing when you are trying to push Your TrafficDetailViewController</p> <p>then please assign image to trafficImage.image not to trafficImage and string to LocationLabel.text because trafficImage is an ImageView not an Image and LocationLable is a label not string.So replace your line with following code</p> <pre><code>trailsController.trafficImage.image = [thumbnails objectAtIndex:indexPath.row]; trailsController.LocationLable.text = [tableData objectAtIndex:indexPath.row]; </code></pre> <p><strong>POST EDIT</strong></p> <p>in .h file</p> <pre><code>@interface TrafficDetailViewViewController : UIViewController @property (strong, nonatomic) IBOutlet UIImageView *trafficImage; @property (strong, nonatomic) IBOutlet UILabel *LocationLable; //Add these two more properties in TrafficDetailViewController @property (strong, nonatomic) UIImage *image; @property (strong, nonatomic) NSString *locationString; @end </code></pre> <p>in .m File:</p> <pre><code>@synthesize trafficImage = _trafficImage; @synthesize LocationLable = _LocationLable; @synthesize image = _image; @synthesize locationString = _locationString; </code></pre> <p>in viewDidLoad method:</p> <pre><code>- (void) viewDidLoad { self.trafficImage.image = _image; self.LocationLabel.text = _locationString; } </code></pre> <p>and then in Previous viewController where you have written the push code for TrafficDetailviewController replace the following code with yours</p> <pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:NO]; TrafficDetailViewViewController *trailsController = [[TrafficDetailViewViewController alloc] init]; trailsController.image = [thumbnails objectAtIndex:indexPath.row]; trailsController.locationString = [tableData objectAtIndex:indexPath.row]; //transfering control to detail view [[self navigationController] pushViewController:trailsController animated:YES]; } </code></pre> <p>The reason behind this is like your ViewController is not loaded before pushing and we are trying to set imageView.image and Lable.text which I think is causing the issue. Please try this and let me know is it working now?</p> <p>Enjoy coding!!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload