This file contains 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
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
self.beansForIdentifiers = [NSMutableDictionary dictionary]; // initialize data structure | |
self.beanManager = [[PTDBeanManager alloc] initWithDelegate:self]; // create an instance of a Bean Manager | |
[self performSelector:@selector(scanForBeans) withObject:nil afterDelay:0.5]; //Start scanning for Beans | |
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Login" | |
style:UIBarButtonItemStylePlain |
This file contains 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
// omitted a ton of code | |
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
[self performSegueWithIdentifier:@"showDetail" sender:self]; | |
[self.tableView deselectRowAtIndexPath:indexPath animated:YES]; | |
} |
This file contains 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
@implementation BeanDetailViewController | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
// Once we load, we will create a singleton and connect to the Bean we selected. | |
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; | |
appDelegate.beanDetailViewController = self; | |
This file contains 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
// omitted tons of code | |
-(void)bean:(PTDBean*)bean serialDataReceived:(NSData*)data | |
{ | |
NSString *receivedMessage=[[NSString alloc]initWithData:data encoding:NSASCIIStringEncoding]; | |
NSLog (@"%@ this works", receivedMessage); | |
// omitted code | |
} | |
// omitted code |
This file contains 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
// omitted code | |
- (instancetype)init | |
{ | |
self = [super init]; // inital. self; overrid. init. | |
if (self) { | |
_locationManager = [[CLLocationManager alloc]init]; | |
} | |
return self; | |
} | |
// omitted code |
This file contains 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
// omitted code | |
- (void)startStandardUpdates | |
{ | |
if (![CLLocationManager locationServicesEnabled]) { | |
NSLog(@"Location services are not available (or are disabled for this app)."); | |
} | |
else { | |
self.locationManager = [[CLLocationManager alloc] init]; | |
self.locationManager.delegate = self; | |
self.locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters; |
This file contains 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
// omitted code | |
- (void)startStandardUpdates{ | |
if (![CLLocationManager locationServicesEnabled]) { | |
NSLog(@"Location services are not available (or are disabled for this app)."); | |
} | |
else { | |
self.locationManager = [[CLLocationManager alloc] init]; | |
self.locationManager.delegate = self; | |
self.locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters; | |
self.locationManager.distanceFilter = 0; |
This file contains 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
// omitted code | |
- (void)updateInterfaceWithLocation:(CLLocation *)lastLocation { | |
// we update the UILabel with the longitude and latitude values | |
self.latitude.text = [NSString stringWithFormat:@"%f",lastLocation.coordinate.latitude]; | |
self.longitude.text = [NSString stringWithFormat:@"%f",lastLocation.coordinate.longitude]; | |
} | |
// omitted code | |
- (IBAction)buttonPress:(id)sender { | |
CLLocation *lastLocation = [NFHLocationManager sharedLocationManager].lastLocation; |
This file contains 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
// omitted code | |
- (void)viewDidLoad | |
{ | |
// omitted code | |
self.timer = [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(timerDidFire:) userInfo:nil repeats:YES]; | |
} | |
-(void)timerDidFire: (id)sender | |
{ | |
NFHLocationManager *locationManager = [NFHLocationManager sharedLocationManager]; |
This file contains 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
// omitted code | |
<form method="POST" class="navbar-form nav-center pull-right" action="/process_login"> | |
<div class="form-group"> | |
<input type="text" placeholder="Username" class="form-control" name="user_name"> | |
<input type="hidden" name="action" value="signIn"> | |
</div> | |
<div class="form-group"> |
OlderNewer