-
Notifications
You must be signed in to change notification settings - Fork 2
/
GpsOrLocationViewController.m
executable file
·95 lines (66 loc) · 2.45 KB
/
GpsOrLocationViewController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//
// GpsOrLocationViewController.m
// searchbar
//
// Created by mmai on 12/6/13.
// Copyright (c) 2013 mmai. All rights reserved.
//
#import "GpsOrLocationViewController.h"
@interface GpsOrLocationViewController ()
@end
@implementation GpsOrLocationViewController
@synthesize locationPicker;
@synthesize locationArray;
@synthesize delegate;
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"locationSegue"]) {
NSInteger row = [locationPicker selectedRowInComponent:0];
NSString * str = [locationArray objectAtIndex:row];
//NSLog(str);
StreamViewController *destViewController = segue.destinationViewController;
if (row == 0){
destViewController.streamArray = [delegate.webData getAllStreams];
}else{
destViewController.streamArray = [delegate.webData getAllStreamsByLocation: str];
}
}
}
// 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 [locationArray count];
}
- (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.
// Do any additional setup after loading the view, typically from a nib.
delegate = (macroinvAppDelegate *) [[UIApplication sharedApplication] delegate]; // to refer to AppDelegate methods
//self.locationArray = [[NSArray alloc] initWithObjects:@"Any", @"Vermont", @"New York", @"Puerto Rico" , nil];
self.locationArray = delegate.webData.getAllStates;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
return [self.locationArray objectAtIndex:row];
}
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
//self.locationPicker.text = [locationArray objectAtIndex:row];
}
@end