ios - Values in my table not showing -


i new xcode. trying small project on ibeacon. problem have included tableview in viewcontroller (i using tab view controller). wanted update table once have found matching beacon major value wanted.

with code, once got region , detected beacon, have received notification. when open notification table not updated array set.

#import "sbsfirstviewcontroller.h"   @interface sbsfirstviewcontroller ()   @property (strong, nonatomic) clbeaconregion *beaconregion; @property (strong, nonatomic) cllocationmanager *locationmanager; @property  bool checkdidenterbusstop; @property (strong, nonatomic) clbeacon *selectedbeacon;  @end  @implementation sbsfirstviewcontroller   nsarray *buses; bool checkdidenterbusstop = no;  -(nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section{  if(checkdidenterbusstop == yes){     return [buses count]; } return 0;  }  -(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:     (nsindexpath *)indexpath{  static nsstring *tableidentifier =@"buscell";   uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:tableidentifier];  if(cell==nil){      cell = [[uitableviewcell alloc]initwithstyle:uitableviewcellstyledefault reuseidentifier:tableidentifier];  }    cell.textlabel.text = [buses objectatindex:indexpath.row];    return cell;    }  - (void)viewdidload { [super viewdidload]; // additional setup after loading view, typically nib.  buses = [nsarray arraywithobjects:@"3", @"83", @"62", nil];  self.locationmanager = [[cllocationmanager alloc] init]; self.locationmanager.delegate = self;  [self initregion];  [self.locationmanager startmonitoringforregion:_beaconregion]; _beaconregion.notifyonentry = yes;  nslog(@"start monitoring");     }    -(void)initregion { nsuuid *demobusstopuuid = [[nsuuid alloc]initwithuuidstring:@"b9407f30-f5f8-466e-aff9-25556b57fe6d"];  self.beaconregion = [[clbeaconregion alloc]initwithproximityuuid:demobusstopuuid major:23118 minor:37538 identifier:@"estimoteatbusstop"];    }     -(void)locationmanager:(cllocationmanager *)manager didenterregion:(clregion *)region{  [self.locationmanager startrangingbeaconsinregion:self.beaconregion]; nslog(@"entered region");    }  -(void)locationmanager:(cllocationmanager *)manager didexitregion:(clregion *)region{  [self.locationmanager stoprangingbeaconsinregion:self.beaconregion]; }    -(void) locationmanager:(cllocationmanager *)manager didrangebeacons:(nsarray *)beacons   inregion:(clbeaconregion *)region {   checkdidenterbusstop=yes;   uilocalnotification *notification = [[uilocalnotification alloc]init]; notification.alertbody = @"you have reached bus stop"; notification.soundname = uilocalnotificationdefaultsoundname;  [[uiapplication sharedapplication] presentlocalnotificationnow:notification];  }      - (void)didreceivememorywarning { [super didreceivememorywarning]; // dispose of resources can recreated. }      @end 

can me out pointing out mistakes. thanks

you need notify tableview data has changed - call

[tableview reloaddata]  

in didrangebeacons method - call numberofrowsinsection again


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -