kamilosxd678

Huja muja maka zbuja

May 21st, 2013
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //
  2. //  PositionsViewController.m
  3. //  mapsy2
  4. //
  5. //  Created by student on 21.05.2013.
  6. //  Copyright (c) 2013 pg. All rights reserved.
  7. //
  8.  
  9. #import "PositionsViewController.h"
  10.  
  11. @implementation PositionsViewController
  12. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  13. {
  14.     // Return the number of sections.
  15.     return 1;
  16. }
  17. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  18. {
  19.     // Return the number of rows in the section.
  20.     CSAppDelegate *del = [[UIApplication sharedApplication ] delegate];
  21.    
  22.     return del.locHandler.locArray.count;
  23. }
  24. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  25. {
  26.     static NSString *CellIdentifier = @"PositionCell";
  27.     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
  28.    
  29.     CSAppDelegate *del = [[UIApplication sharedApplication ] delegate];
  30.    
  31.     CLLocation *l =  [del.locHandler.locArray objectAtIndex:indexPath.row] ;
  32.    
  33.     NSString *str = [NSString stringWithFormat:@"%f,%f", l.coordinate.longitude, l.coordinate.latitude ];
  34.     cell.textLabel.text = str;
  35.     return cell;
  36. }
  37. - (void) viewDidLoad
  38. {
  39.     [super viewDidLoad];
  40.     [[NSNotificationCenter defaultCenter] addObserver: self selector:@selector(zmianaPozycji:) name:@"lokalizacja" object:nil];
  41. }
  42. -(void) zmianaPozycji:(NSNotification *)notification
  43. {
  44.     [self.tableView2 reloadData];
  45.    
  46. }
  47. @end
Advertisement
Add Comment
Please, Sign In to add comment