iOS - UIWebView not displaying HTML - html

I have a UIViewController inside of which I put a UIWebView
Then I added this to the .h file:
#import <UIKit/UIKit.h>
#interface BuildBusinessController : UIViewController
#property (weak, nonatomic) IBOutlet UIWebView *theWebView;
#end
and have this as the .m file
#import "BuildBusinessController.h"
#interface BuildBusinessController ()
#end
#implementation BuildBusinessController
#synthesize theWebView;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
theWebView.delegate = self;
}
- (void)viewDidUnload
{
[self setTheWebView:nil];
[super viewDidUnload];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (void)viewDidAppear:(BOOL)animated
{
NSString *htmlFile = [[NSBundle mainBundle] pathForResource:#"build_business" ofType:#"html"];
NSURL *url = [NSURL fileURLWithPath:htmlFile];
NSURLRequest *rq = [NSURLRequest requestWithURL:url];
[theWebView loadRequest:rq];
}
#end
But the build_business.html file is not rendering inside the view, and also I get a warning on this line: theWebView.delegate = self; which says:
Assigning to id 'UIWebViewDelegate from incompatible type BuildBusinessController *const_string
Would anyone know what I am doing wrong here? It feels I am forgetting some one small thing :)

In addition to F.X. answer, I think you forgot to add this in viewDidAppear (after loadRequest):
[self.view addSubview:theWebView];
Update: The issue is caused by OP failing to configure delegate for UIWebView in Storyboard. The code snippet provided here will only work if you are coding it manually. Otherwise, as stated by #F.X. in the comments below, Storyboard will implement this automatically.

You're just forgetting UIWebViewDelegate on your class definition :
#import <UIKit/UIKit.h>
#interface BuildBusinessController : UIViewController <UIWebViewDelegate>
#property (weak, nonatomic) IBOutlet UIWebView *theWebView;
#end

Related

How to use delegate here? I can't get it to work

I know there is very simple question, but few hours I can not do this.
I got 2 classes:
1. LoginViewController : UIViewController
2. WebRequests : NSObject - it makes request and got response from server (singleton)
Then I got response I want to run MyMethod in LoginViewController from WebRequests.
I do it like here, but it not works:
WebRequests.h
#protocol WebRequestsDelagate <NSObject>
#required
- (void) MyMethod;
#end
#interface WebRequests : NSObject
...
#property (nonatomic, weak) id <WebRequestsDelagate> delegate;
WebRequests.m
#implementation WebRequests
//singleton
+ (WebRequests *)sharedInstance {
static dispatch_once_t p = 0;
__strong static id _sharedObject = nil;
dispatch_once(&p, ^{
_sharedObject = [[self alloc] init];
});
return _sharedObject;
}
- (id)init {
if (self = [super init]) {
LoginViewController * loginViewController = [[LoginViewController alloc] init];
self.delegate = loginViewController;
}
return self;
}
- (void) someMethod {
//here I got response
[self.delegate runThisMethod];
I do not move on in runThisMethod in LoginViewController.
Why does it not work?
UPDATE
#implementation LoginViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
}
return self;
}
// AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
return YES;
}
If that's your real code, then the loginViewController created in the [WebRequests init] method will be destroyed at the end of the if statement (i.e. pretty much straight away):
- (id)init {
if (self = [super init]) {
LoginViewController * loginViewController = [[LoginViewController alloc] init];
self.delegate = loginViewController;
}
return self;
}
I don't understand why you are creating view controllers in this method; it would be more normal to create the view controller outside of this class (through whatever method) and then register it as the delegate of the WebRequests object.
Okay, I'm a bit confused by your code but maybe you're looking for something like
WebRequests *webRequests = [WebRequests sharedInstance];
webRequests.delegate = self;
perhaps in LoginController's viewDidLoad.

MapKit annotations imported from MySQL

I've been creating an app that is supposed to show Pins on a Map that are stored in a MySQL Database. I've used JavaScript to convert the Database to JSON then converted the JSON data into NSStrings.
The problem here is I then needed to convert two of these NSStrings into doubles because my Pins need to placed via latitude and longitude, here is my code below that when it builds shows no issues but crashes my simulator and shows up some errors which I shall post directly under my code.
Hazards.h
#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
#interface Hazards : NSObject <MKAnnotation>
#property (nonatomic, assign) CLLocationDegrees latitude;
#property (nonatomic, assign) CLLocationDegrees longitude;
#property (nonatomic, copy) NSString *title;
#property (nonatomic, copy) NSString *subtitle;
#property (nonatomic, strong) NSString * ID;
#property (nonatomic, strong) NSString * ROUTE;
#property (nonatomic, strong) NSString * ADDRESS;
#property (nonatomic, strong) NSString * LATITUDE;
#property (nonatomic, strong) NSString * LONGITUDE;
#property (nonatomic, strong) NSString * HAZARD;
#property (nonatomic, strong) NSString * RISK;
// Methods
- (id) initWithID: (NSString *) hazardsID andROUTE: (NSString *) hazardsROUTE andADDRESS: (NSString *) hazardsADDRESS andLATITUDE: (NSString *) hazardsLATITUDE andLONGITUDE: (NSString *) hazardsLONGITUDE andHAZARD: (NSString *) hazardsHAZARD andRISK: (NSString *) hazardsRISK;
#end
Hazards.m
#import "Hazards.h"
#implementation Hazards
#synthesize coordinate, title, subtitle, ID, ROUTE, ADDRESS, LATITUDE, LONGITUDE, HAZARD, RISK, latitude, longitude;
- (id) initWithID: (NSString *) hazardsID andROUTE: (NSString *) hazardsROUTE andADDRESS: (NSString *) hazardsADDRESS andLATITUDE: (NSString *) hazardsLATITUDE andLONGITUDE: (NSString *) hazardsLONGITUDE andHAZARD: (NSString *) hazardsHAZARD andRISK: (NSString *) hazardsRISK {
self = [super init];
if (self)
{
ID = hazardsID;
ROUTE = hazardsROUTE;
ADDRESS = hazardsADDRESS;
LATITUDE = hazardsLATITUDE;
LONGITUDE = hazardsLONGITUDE;
HAZARD = hazardsHAZARD;
RISK = hazardsRISK;
latitude = [hazardsLATITUDE doubleValue]; // convert the string hazardsLatitude to a double here
longitude = [hazardsLONGITUDE doubleValue]; // convert the string hazardsLongitude to a double here
}
return self;
}
-(NSString *)title
{
return self.HAZARD;
}
-(NSString *)subtitle
{
return self.ADDRESS;
}
#end
ViewController.h
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
#import "Hazards.h"
#interface ViewController : UIViewController
#property (nonatomic, strong) NSMutableArray *json;
#property (nonatomic, strong) NSMutableArray *hazardsArray;
#property (weak, nonatomic) IBOutlet MKMapView *mapView;
#pragma mark - Methods
-(void) retrieveData;
#end
ViewController.m
#import "ViewController.h"
#import "Hazards.h"
#interface ViewController ()
#end
// Railway Street Ballymena Coordinates
#define BALLYMENA_LATITUDE 54.857719;
#define BALLYMENA_LONGITUDE -6.280654;
// Span
#define THE_SPAN 0.01f;
#define getDataURL #"www.ryanball.net/royalmail/json.php"
#implementation ViewController
#synthesize json, hazardsArray, mapView;
- (void)viewDidLoad
{
[super viewDidLoad];
// Create the region
MKCoordinateRegion myRegion;
// Center
CLLocationCoordinate2D center;
center.latitude = BALLYMENA_LATITUDE;
center.longitude = BALLYMENA_LONGITUDE;
//Span
MKCoordinateSpan span;
span.latitudeDelta = THE_SPAN;
span.longitudeDelta = THE_SPAN;
myRegion.center = center;
myRegion.span = span;
// Set our mapview
[mapView setRegion:myRegion animated: YES];
// Annotation
NSMutableArray *locations = [[NSMutableArray alloc] init];
CLLocationCoordinate2D location;
Hazards *myAnn;
// Pin to show Royal Mail Ballymena delivery office
myAnn = [[Hazards alloc] init];
location.latitude = BALLYMENA_LATITUDE;
location.longitude = BALLYMENA_LONGITUDE;
myAnn.coordinate = location;
myAnn.title = #"Royal Mail Ballymena";
myAnn.subtitle = #"111, Railway Street";
[locations addObject:myAnn];
[self.mapView addAnnotations:locations];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Methods
-(void) retrieveData {
NSURL *url = [NSURL URLWithString:getDataURL];
NSData *data = [NSData dataWithContentsOfURL:url];
json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
// Setup our hazards array
hazardsArray = [[NSMutableArray alloc] init];
for (int i =0; i < json.count; i++) {
// Create hazard object
NSString *hazardsID = [[json objectAtIndex:i] objectForKey:#"ID"];
NSString *hazardsROUTE = [[json objectAtIndex:i] objectForKey:#"ROUTE"];
NSString *hazardsADDRESS = [[json objectAtIndex:i] objectForKey:#"ADDRESS"];
NSString *hazardsLATITUDE = [[json objectAtIndex:i] objectForKey:#"LATITUDE"];
NSString *hazardsLONGITUDE = [[json objectAtIndex:i] objectForKey:#"LONGITUDE"];
NSString *hazardsHAZARD = [[json objectAtIndex:i] objectForKey:#"HAZARD"];
NSString *hazardsRISK = [[json objectAtIndex:i] objectForKey:#"RISK"];
Hazards *myHazards = [[Hazards alloc] initWithID:hazardsID andROUTE:hazardsROUTE andADDRESS:hazardsADDRESS andLATITUDE:hazardsLATITUDE andLONGITUDE:hazardsLONGITUDE andHAZARD:hazardsHAZARD andRISK:hazardsRISK];
// Add our hazards object to our hazards array
[hazardsArray addObject:myHazards];
}
[self.mapView addAnnotations:hazardsArray];
}
#end
Here is the error log I get in the console:
2013-04-25 09:04:43.628 RoyalMailApp[6596:c07] -[Hazards setCoordinate:]: unrecognized selector sent to instance 0x8c63a60
2013-04-25 09:04:43.629 RoyalMailApp[6596:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Hazards setCoordinate:]: unrecognized selector sent to instance 0x8c63a60'
*** First throw call stack:
(0x1b3c012 0x1458e7e 0x1bc74bd 0x146c7ea 0x1b2bcf9 0x1b2b94e 0x2698 0x47e1c7 0x47e232 0x3cd3d5 0x3cd76f 0x3cd905 0x3d6917 0x39a96c 0x39b94b 0x3accb5 0x3adbeb 0x39f698 0x1a97df9 0x1a97ad0 0x1ab1bf5 0x1ab1962 0x1ae2bb6 0x1ae1f44 0x1ae1e1b 0x39b17a 0x39cffc 0x215d 0x2085 0x1)
libc++abi.dylib: terminate called throwing an exception
(lldb)

Calling coordinates from MySQL database with this code causes simulator to display a SIGABRT error. What's wrong?

When I use this code to try and call Lat & Long coordinates from a MySQL database (and display them on a MapView), the app runs fine. Everything appears to work, but for some reason, xcode pauses the simulator before the map loads, and throws me a SIGABRT. Any idea why? See below:
MapViewController.h
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
#interface MapViewController : UIViewController <MKMapViewDelegate>
#property (nonatomic, strong) IBOutlet MKMapView *mapView;
#property (nonatomic, retain) NSMutableArray *dispensaries;
#property (nonatomic, retain) NSMutableData *data;
#end
MapViewController.m
#import "MapViewController.h"
#import "MapViewAnnotation.h"
#implementation MapViewController
#synthesize mapView;
#synthesize dispensaries;
#synthesize data;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (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 {
[super viewDidUnload];
NSLog(#"Getting Device Locations");
NSString *hostStr = #"http://stylerepublicmagazine.com/dispensaries.php";
NSData *dataURL = [NSData dataWithContentsOfURL:[NSURL URLWithString:hostStr]];
NSString *serverOutput = [[NSString alloc] initWithData:dataURL encoding: NSASCIIStringEncoding];
NSLog(#"server output: %#", serverOutput);
NSMutableArray *array = (NSMutableArray *)dispensaries;
dispensaries = [NSJSONSerialization JSONObjectWithData:data options:nil error:nil];
for (NSDictionary *dictionary in array) {
CLLocationCoordinate2D coord = {[[dictionary objectForKey:#"lat"] doubleValue], [[dictionary objectForKey:#"lng"] doubleValue]};
MapViewAnnotation *ann = [[MapViewAnnotation alloc] init];
ann.title = [dictionary objectForKey:#"Name"];
ann.coordinate = coord;
[mapView addAnnotation:ann];
[mapView setMapType:MKMapTypeStandard];
[mapView setZoomEnabled:YES];
[mapView setScrollEnabled:YES];
self.mapView.delegate = self;
}
}
- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
{
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(userLocation.coordinate, 800, 800);
[self.mapView setRegion:[self.mapView regionThatFits:region] animated:YES];
MKPointAnnotation *point = [[MKPointAnnotation alloc] init];
point.coordinate = userLocation.coordinate;
point.title = #"You Are Here";
point.subtitle = #"Your current location";
[self.mapView addAnnotation:point];
}
Ok, so now you have the JSON. You are going to have to decode that using NSXMLParser. Or, if you want to turn that into objects, you could use my open source library on GitHub, which allows you to simply implement NSCoding protocol and instantiate objects (or encode them) as JSON. That's here.

Getting the value of a delegate upon clicking back?

I have two class files. ViewController and ChooseServerView. A user clicks a cell within the ViewController class which pushes to the ChooseServerView. When a user makes a selection in ChooseServerView the value of that cell gets passed to the delegate. Now, these two views are in front of a navigation controller, so in the ChooseServerView there is a back button. When the user clicks back I want to update the cell in the first view with the new value from the delegate, make sense?
ViewController.h
#import <UIKit/UIKit.h>
#import "ChooseServerView.h"
#interface ViewController : UIViewController <UITableViewDataSource, UITableViewDelegate, serverUserChoice>
{
NSString *testLocation;
}
#property (nonatomic, retain) NSString *testLocation;
#end
View Controller.m
#import "ViewController.h"
#import "ChooseServerView.h"
#import "AppDelegate.h"
#interface ViewController ()
#end
#implementation ViewController
#synthesize testLocation;
- (void)viewDidLoad
{
NSUserDefaults *sharedPref = [NSUserDefaults standardUserDefaults];
testLocation =[sharedPref stringForKey:#"defaultLocation"];
NSLog(#"Location Chosen: %#",testLocation);
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
#pragma mark - Table View Methods
- (void) userDidChoose:(NSString *) server {
testLocation = server;
NSLog(#"Test Location %#", server);
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView; // Default is 1 if not implemented
{
return 2;
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section; // fixed font style. use custom view (UILabel) if you want something different
{
switch (section) {
case 0:
return #"Choose Test Location:";
break;
case 1:
return #"Choose Test Type:";
default:
return #"Unknown";
break;
}
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
{
switch (section) {
case 0:
return 1;
break;
case 1:
return 1;
default:
return 0;
break;
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
{
UITableViewCell *serverLocCell = [tableView dequeueReusableCellWithIdentifier:#"serverLocation"];
switch (indexPath.section) {
case 0:
serverLocCell.textLabel.text = testLocation;
serverLocCell.detailTextLabel.text = #"Change";
break;
case 1:
serverLocCell.textLabel.text = #"Speed Test";
serverLocCell.detailTextLabel.text = #"Change";
break;
default:
break;
}
return serverLocCell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
switch (indexPath.section) {
case 0:
[self performSegueWithIdentifier:#"toServerChoice" sender:self];
break;
case 1:
[self performSegueWithIdentifier:#"toTestType" sender:self];
break;
default:
break;
}
}
#end
ChooseServerView.h
#import <UIKit/UIKit.h>
#class ViewController;
#protocol serverUserChoice <NSObject>
#optional
- (void)userDidChoose:(NSString *) server;
#end
#interface ChooseServerView : UIViewController <UITableViewDataSource, UITableViewDelegate, serverUserChoice>
{
NSArray *serverSelection;
NSArray *tqServerSelection;
}
#property (nonatomic, retain) NSArray *serverSelection;
#property (nonatomic, retain) NSArray *qServerSelection;
#property (weak, nonatomic) IBOutlet UITableView *tableView;
#property(retain) NSIndexPath* lastIndexPath;
#property (nonatomic, assign) id <serverUserChoice> serverDelegate;
#end
ChooseServerView.m
#import "ChooseServerView.h"
#import "ViewController.h"
#import "AppDelegate.h"
#define totalSections 2
#define standardSection 0
#define qualitySection 1
#interface ChooseServerView ()
#end
#implementation ChooseServerView;
#synthesize serverSelection;
#synthesize qServerSelection;
#synthesize lastIndexPath;
#synthesize serverDelegate;
- (void)viewDidLoad
{
serverSelection = [[NSArray alloc] initWithObjects:#"Chicgo, IL",#"London, UK",#"San Jose, CA",#"Washington, DC", nil];
qServerSelection = [[NSArray alloc] initWithObjects:#"Chicgo, IL (Q)",#"London, UK (Q)",#"San Jose, CA (Q)",#"Washington, DC (Q)", nil];
[super viewDidLoad];
}
#pragma mark - Table View Methods
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView; // Default is 1 if not implemented
{
return totalSections;
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section; // fixed font style. use custom view (UILabel) if you want something different
{
switch (section) {
case standardSection:
NSLog(#"Std Heading Set");
return #"Standard Test Locations:";
break;
case qualitySection:
NSLog(#"Qual Heading Set");
return #"Quality Test Locations:";
break;
default:
NSLog(#"Section Count Error");
return #"Section Count Error";
break;
}
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
{
if (section == 0) {
NSLog(#"Std Loc Set");
return [serverSelection count];
}
else {
NSLog(#"Quality Loc Set");
return [qServerSelection count];
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
{
UITableViewCell *serverLoc = [tableView dequeueReusableCellWithIdentifier:#"serverSelection"];
switch (indexPath.section) {
case standardSection:
serverLoc.textLabel.text = [self.serverSelection objectAtIndex:indexPath.row];
break;
case qualitySection:
serverLoc.textLabel.text = [self.qServerSelection objectAtIndex:indexPath.row];
break;
default:
break;
}
return serverLoc;
}
-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *cellvalue;
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
cell.accessoryType = UITableViewCellAccessoryCheckmark;
cellvalue = cell.textLabel.text;
[serverDelegate userDidChoose:cellvalue];
NSLog(#"Cell Selected is %#",cellvalue);
[cell setSelected:FALSE animated:TRUE];
}
#end
I can see the correct value gets passed to the delegate, I just don't know how to "call" that delegate/method when going back using the automatic back button implemented by the nav controller.
Any ideas would be great.
As per answer below:
Added to my ViewController.h
#property (nonatomic, weak) IBOutlet UITableView *tableView;
Added to my ViewController.m
-(void) viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.tableView reloadData];
}
Still no joy at this stage. First cell fails to update upon pressing the back button as provided by the navigation controller.
Looks like you are almost there.
I think the issue is that your UITableView is not being reloaded to represent the updated value of testLocation. I don't see a reference to the UITableView that is being managed by your ViewController, first add an outlet to ViewController.m to point to this table view.
Then, add the following in your ViewController.m
-(void) viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.tableView reloadData];
}
You also need to make sure you set your ViewController as the delegate of ChooseServerViewController. (You should rename ChooseServerView.m to ChooseServerViewController.m for clarity, as it's a view controller subclass- I've referred to it as such below)
You can set the delegate by adding a prepare for segue method in ViewController.m - something like:
(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
ChooseServerViewController *viewController = (ChooseServerViewController *)segue.destinationViewController;
viewController.serverDelegate = self;
}
I would also look into using UITableViewController for these two controller classes, since it appears that's the type of functionality you are looking for.

loading image from view controller 1 NSDictionary into detailViewController

I am trying to use an NSMutableDictionary in a view controller to load an image and text into a detail view controller when an image is tapped. I am new to programming and I am trying to understand. Could someone please help.
Here is my code in the view controller 1 .m
- (void) coverflowView:(TKCoverflowView*)coverflowView coverAtIndexWasDoubleTapped:(int)index{
SomeDetailViewController *detailViewController = [[SomeDetailViewController alloc] initWithNibName:#"SomeDetailViewController" bundle:nil];
if ((int)index == 0) {
NSMutableDictionary *myDictionary = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"0002.jpg", #"imagekey",
#"This is #1", #"textkey", nil];
NSLog(#"%#", [myDictionary objectForKey:#"imagekey"]);
NSLog(#"%#", [myDictionary objectForKey:#"textkey"]);
}
[self.navigationController pushViewController:detailViewController animated:YES];
}
when I build and run this the image key and text key are called but don't show up in the detail view controller.
my detailViewController.h
#import <QuartzCore/QuartzCore.h>
#interface SomeDetailViewController : UIViewController < UITextViewDelegate, UINavigationControllerDelegate>{
IBOutlet UIImageView *imageView;
IBOutlet UITextView *myText;
NSString *imagekey;
NSMutableDictionary *myDictionary;
NSString *textkey;
}
#property (nonatomic, retain) IBOutlet UIImageView *imageView;
#property (nonatomic, retain) IBOutlet UITextView *myText;
#property (nonatomic, retain) NSString *imagekey;
#property (nonatomic, retain) NSString *textkey;
#property (nonatomic, retain) NSMutableDictionary *myDictionary;
#end
and my detailViewContoller .m
#synthesize myDictionary;
- (void)viewDidLoad
{
[super viewDidLoad];
imageView .image = [[UIImage alloc] init];
self.imageView.image =[UIImage imageNamed:[(NSMutableDictionary *)myDictionary objectForKey:#"imagekey"]];
self.myText.text =[(NSMutableDictionary *)myDictionary objectForKey:#"textkey"];
}
I know this is similar to another post but I was advise not to use NSUsersDefaults so I am trying this.
There are no errors but nothing shows up