All,
Semi-new to Iphone Programming this forum has been a great resource.
I am working with NaVcontroller and 5 screens. Currently have two working at once and can't seem to get the others working.
what I am attempting to accomplish is this:
The user logs in to the webservice (MYSQL DB) on the phone and then it presents a table view of the information out of the JSON array that I have parsed into it. when the user clicks on the row for the detail view it will not push the detail to the screen.
If I alter the navcontroller to only allow the table and the detail it works fine.
we have been working on this for three weeks and can't seem to get it to push from screen 1 to 2 to 3 for some reason that we are lost in.
here is the code appdelegate.m
viewcontroller.m (second screen)
let me know if you need to see other code.... and I will post it
thanks
RON
Semi-new to Iphone Programming this forum has been a great resource.
I am working with NaVcontroller and 5 screens. Currently have two working at once and can't seem to get the others working.
what I am attempting to accomplish is this:
The user logs in to the webservice (MYSQL DB) on the phone and then it presents a table view of the information out of the JSON array that I have parsed into it. when the user clicks on the row for the detail view it will not push the detail to the screen.
If I alter the navcontroller to only allow the table and the detail it works fine.
we have been working on this for three weeks and can't seem to get it to push from screen 1 to 2 to 3 for some reason that we are lost in.
here is the code appdelegate.m
Code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.viewController = [[loginViewController alloc] initWithNibName:@"loginViewController" bundle:nil];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:self.viewController];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
viewcontroller.m (second screen)
Code:
- (void)viewDidLoad
{
[super viewDidLoad];
username = username.text;
password = password.text;
NSLog(@"username=%@", username);
NSLog(@"Password=%@", password);
self.title = @"list view";
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
NSURL *url = [NSURL URLWithString:@"url removed for privacy"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[[NSURLConnection alloc] initWithRequest:request delegate:self];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
data = [[NSMutableData alloc] init];
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)theData
{
[data appendData:theData];
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
news = [NSJSONSerialization JSONObjectWithData:data options:nil error:nil];
[mainTableView reloadData];
}
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
UIAlertView *errorView = [[UIAlertView alloc] initWithTitle:@"Error" message:@"The download could not complete - please make sure you're connected to either 3G or Wi-Fi." delegate:nil cancelButtonTitle:@"Dismiss" otherButtonTitles:nil];
[errorView show];
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
}
- (int)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (int)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [news count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MainCell"];
if(cell == nil){
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"MainCell"];
}
cell.textLabel.text = [[news objectAtIndex:indexPath.row] objectForKey:@"dname"];
cell.detailTextLabel.text = [[news objectAtIndex:indexPath.row] objectForKey:@"dlloc"];
NSLog(@"%@", cell);
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
DetailViewController *detailViewController = [[DetailViewController alloc] initWithNibName:@"DetailViewContoller" bundle:nil];
detailViewController.title = [[news objectAtIndex:indexPath.row] objectForKey:@"dname"];
detailViewController.newsArticle = [news objectAtIndex:indexPath.row];
}
let me know if you need to see other code.... and I will post it
thanks
RON