ios - UI Activity Indicator not working from tableview -
the issue is, have been unable ui activity indicator activate animation or show when user selects cell table view.
the execution cycle looks this:
- view loads table view
- user clicks cell - (uiactivityindicator fails @ step appear or animate)
- activity indicator appears while data being gathered
- new view called loaded data
- user clicks button navigation bar
- repeat cycle
loading object activity indicator link storyboard.
@synthesize jsonconnection, bakeryproductarray, bakerytableview, loading; - (void)viewdidload { [super viewdidload]; // additional setup after loading view, typically nib. [self retrievedata]; } - (void)didreceivememorywarning { [super didreceivememorywarning]; // dispose of resources can recreated. } - (void)viewwillappear:(bool)animated { [self.navigationcontroller setnavigationbarhidden:yes animated:animated]; [super viewwillappear:animated]; } - (void)viewwilldisappear:(bool)animated { loading.hidden = yes; [self.navigationcontroller setnavigationbarhidden:no animated:animated]; [super viewwilldisappear:animated]; } #pragma mark - uitableview datasource -(nsinteger)numberofsectionsintableview:(uitableview *)tableview { return 1; } -(nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { if (tableview == self.searchdisplaycontroller.searchresultstableview) { return [searchresults count]; } else { return [bakeryproductarray count]; } } -(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstylesubtitle reuseidentifier:cellidentifier]; } if (tableview == self.searchdisplaycontroller.searchresultstableview) { foodproducts *currentproduct = [searchresults objectatindex:indexpath.row]; cell.textlabel.text = currentproduct.productname; } else { foodproducts *currentproduct = [bakeryproductarray objectatindex:indexpath.row]; cell.textlabel.text = currentproduct.productname; cell.detailtextlabel.text = currentproduct.productquantity; cell.accessorytype = uitableviewcellaccessorydisclosureindicator; } return cell; } #pragma mark - uitableview delegate methods -(void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { if (bakerytableview == self.searchdisplaycontroller.searchresultstableview) { [self performseguewithidentifier: @"bakerydetails" sender: self]; } detailedviewcontroller *productinfo = [self.storyboard instantiateviewcontrollerwithidentifier:@"bakerydetails"]; //retrieve current user array foodproducts *currentproduct2 = [bakeryproductarray objectatindex:indexpath.row]; productinfo.productname = currentproduct2.productname; productinfo.productimage = currentproduct2.productimgurl; productinfo.productdescription = currentproduct2.productdescription; productinfo.productprice = currentproduct2.productprice; productinfo.productquantity = currentproduct2.productquantity; productinfo.productallergy = currentproduct2.productallergy; [loading startanimating]; [self.navigationcontroller pushviewcontroller:productinfo animated:yes]; [bakerytableview deselectrowatindexpath:indexpath animated:yes]; }
i have check obvious stuff like:
if activity indicator behind object. not activating features ib
if need more info, say.
any great guys
cheers
correct me if im wrong, can't find anywhere, have declared activity indicator. try adding viewdidload, or starts animating
loading = [[uiactivityindicatorview alloc]initwithactivityindicatorstyle:uiactivityindicatorviewstylegray]; loading.frame =//set frame [self.view addsubview:loading]; //or add cell in didselectrow etc
hope helps
Comments
Post a Comment