ios - AlertView to Pause Code -


this seems white elephant iphone. i've tried sorts, loops , can't make work.

i have view loads table. i've moved object archiving , development purposes want have initial alertview asks if user wants use saved database or download fresh copy

(void)showdbalert {      uiactionsheet *alertdialogopen;     alertdialogopen = [[uiactionsheet alloc] initwithtitle:@"downloaddb?"                      delegate:self                     cancelbuttontitle:@"use saved"                      destructivebuttontitle:@"download db"                                           otherbuttontitles:nil];     [alertdialogopen showinview:self.view]; } 

i'm using actionsheet in instance. , have implemented protocol:

@interface clubtableviewcontroller : uitableviewcontroller <uitableviewdelegate, uitableviewdatasource, uiactionsheetdelegate> 

based on run check button pressed:

(void)actionsheet:(uiactionsheet *) actionsheet clickedbuttonatindex:(nsinteger)buttonindex {       nsstring *buttontitle=[actionsheet buttontitleatindex:buttonindex];      if ( [buttontitle isequaltostring:@"download db"] ) {          [self loaddatafromdb];      }      if ([buttontitle isequaltostring:@"use saved"] ) {          self.rows = [nskeyedunarchiver unarchiveobjectwithfile:[self archivepath]];          if (self.rows == nil) {             [self loaddatafromdb];         }        } } 

the problem code build table executes before user has made there choice. causes sorts of havok. result, how can pause code until user has made there choice?

if using uitableview, not able "pause" code, wouldn't method of choice anyways. possible solution load empty table (return 0 in (uitableview *)tableview:numberofrowsinsection) until user has selected something, reload tableview's data [tableview reloaddata];


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -