-
-
Save Sterling715/3375151 to your computer and use it in GitHub Desktop.
Menu page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// HomeViewController.m | |
// FreeCare | |
// | |
// Created by Shashi on 08/10/11. | |
// Copyright __MyCompanyName__ 2011. All rights reserved. | |
// | |
#import "HomeViewController.h" | |
#import "ClinicListViewController.h" | |
@implementation HomeViewController | |
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. | |
- (void)viewDidLoad { | |
self.navigationController.navigationBarHidden =YES; | |
[super viewDidLoad]; | |
[btnState setTitle:@" Select a State" forState:UIControlStateNormal]; | |
[btnState setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; | |
btnState.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; | |
btnState.titleLabel.font=[UIFont fontWithName:@"Helvetica" size:22]; | |
[btnCounty setTitle:@" Select a County" forState:UIControlStateNormal]; | |
[btnCounty setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; | |
btnCounty.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; | |
btnCounty.titleLabel.font=[UIFont fontWithName:@"Helvetica" size:22]; | |
[btnService setTitle:@" Select a Service" forState:UIControlStateNormal]; | |
[btnService setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; | |
btnService.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; | |
btnService.titleLabel.font=[UIFont fontWithName:@"Helvetica" size:22]; | |
btnState.enabled = YES; | |
btnCounty.enabled = NO; | |
btnService.enabled = NO; | |
btnSubmit.enabled = NO; | |
//strState = [[NSString alloc] init]; | |
// strCounty = [[NSString alloc] init]; | |
// strService = [[NSString alloc] init]; | |
} | |
#pragma mark - | |
#pragma mark USER Function | |
-(IBAction) selectBtnClick:(id)sender | |
{ | |
UIButton *btn = (UIButton *)sender; | |
pickerView.hidden = NO; | |
appDelegate.bannerView_.hidden = YES; | |
if (btn.tag == 10) { | |
lblPickerTitle.text = @"State"; | |
[appDelegate getStates]; | |
} | |
else if (btn.tag == 11) { | |
lblPickerTitle.text = @"County"; | |
[appDelegate getCounty:strState]; | |
} | |
else if (btn.tag == 12) { | |
lblPickerTitle.text = @"Service"; | |
[appDelegate getServices:strState :strCounty]; | |
} | |
[picker reloadComponent:0]; | |
} | |
-(IBAction) doneBtnClick | |
{ | |
pickerView.hidden = YES; | |
appDelegate.bannerView_.hidden = NO; | |
if ([lblPickerTitle.text isEqualToString:@"State"]) { | |
strState = [NSString stringWithFormat:@"%@",[appDelegate.arrResult objectAtIndex:[picker selectedRowInComponent:0]]]; | |
[strState retain]; | |
[btnState setTitle:[NSString stringWithFormat:@" %@",strState] forState:UIControlStateNormal]; | |
btnCounty.enabled = YES; | |
} | |
else if ([lblPickerTitle.text isEqualToString:@"County"]) { | |
strCounty = [NSString stringWithFormat:@"%@",[appDelegate.arrResult objectAtIndex:[picker selectedRowInComponent:0]]]; | |
[strCounty retain]; | |
[btnCounty setTitle:[NSString stringWithFormat:@" %@",strCounty] forState:UIControlStateNormal]; | |
btnService.enabled = YES; | |
} | |
else if ([lblPickerTitle.text isEqualToString:@"Service"]) { | |
strService = [NSString stringWithFormat:@"%@",[appDelegate.arrResult objectAtIndex:[picker selectedRowInComponent:0]]]; | |
[strService retain]; | |
[btnService setTitle:[NSString stringWithFormat:@" %@",strService] forState:UIControlStateNormal]; | |
btnSubmit.enabled = YES; | |
} | |
} | |
-(IBAction) cancelBtnClick | |
{ | |
//tbl.frame = CGRectMake(0, 44, 320, 310); | |
pickerView.hidden = YES; | |
appDelegate.bannerView_.hidden = NO; | |
} | |
-(IBAction) btnSubmitClick | |
{ | |
[appDelegate getClinicDetial:strService :strState :strCounty]; | |
ClinicListViewController *objClinicListViewController = [[ClinicListViewController alloc] initWithNibName:@"ClinicListViewController" bundle:nil]; | |
[self.navigationController pushViewController:objClinicListViewController animated:YES]; | |
[objClinicListViewController release]; | |
} | |
#pragma mark - | |
#pragma mark ------------------- PickerView ------------------------- | |
// returns the number of 'columns' to display. | |
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView | |
{ | |
return 1; | |
} | |
// returns the # of rows in each component.. | |
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component | |
{ | |
return [appDelegate.arrResult count]; | |
} | |
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component | |
{ | |
return [appDelegate.arrResult objectAtIndex:row]; | |
} | |
#pragma mark - | |
#pragma mark Memory Management | |
- (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. | |
} | |
- (void)viewDidUnload { | |
// Release any retained subviews of the main view. | |
// e.g. self.myOutlet = nil; | |
} | |
- (void)dealloc { | |
[super dealloc]; | |
} | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ClinicListViewController.m | |
// FreeCare | |
// | |
// Created by Shashi on 09/10/11. | |
// Copyright 2011 __MyCompanyName__. All rights reserved. | |
// | |
#import "ClinicListViewController.h" | |
#import "ClinicDetialViewController.h" | |
@implementation ClinicListViewController | |
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. | |
- (void)viewDidLoad { | |
self.navigationController.navigationBarHidden = YES; | |
[super viewDidLoad]; | |
} | |
- (void)viewWillAppear:(BOOL)animated | |
{ | |
[tblClinic reloadData]; | |
} | |
- (IBAction) backBtnClicked | |
{ | |
[self.navigationController popViewControllerAnimated:YES]; | |
} | |
#pragma mark - | |
#pragma mark -------------------------Table Data Source Methods ------------------------------------ | |
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView | |
{ | |
return 1; | |
} | |
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { | |
return [appDelegate.arrResult count]; | |
} | |
// Customize the appearance of table view cells. | |
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | |
static NSString *clinicCellIdentifier = @"clinicCellIdentifier"; | |
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:clinicCellIdentifier]; | |
if (cell == nil) | |
{ | |
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:clinicCellIdentifier] autorelease]; | |
} | |
cell.textLabel.text = [[appDelegate.arrResult objectAtIndex:indexPath.row]valueForKey:@"name"]; | |
cell.textLabel.font = [UIFont boldSystemFontOfSize:17]; | |
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; | |
return cell; | |
} | |
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
ClinicDetialViewController *objClinicDetialViewController = [[ClinicDetialViewController alloc] initWithNibName:@"ClinicDetialViewController" bundle:nil]; | |
objClinicDetialViewController.dictClinic = [appDelegate.arrResult objectAtIndex:indexPath.row]; | |
[self.navigationController pushViewController:objClinicDetialViewController animated:YES]; | |
[objClinicDetialViewController release]; | |
} | |
#pragma mark - | |
#pragma mark Memory management | |
- (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. | |
} | |
- (void)viewDidUnload { | |
[super viewDidUnload]; | |
// Release any retained subviews of the main view. | |
// e.g. self.myOutlet = nil; | |
} | |
- (void)dealloc { | |
[super dealloc]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment