ios - Trying to make a TableviewCell call a cell number -


in app have page saves contact's name, amount owe, , cell number. have 2 sections. 1 section list of people owe, , other section list of people owe you. when user taps on someone, want able automatically call user's cell number. have far.

-(void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath     *)indexpath {     if (indexpath.section == 0)     {         nsmanagedobjectcontext *managedobjectcontext = [self managedobjectcontext];         nsfetchrequest *fetchrequest = [[nsfetchrequest alloc] initwithentityname:@"owedmoney"];         nsmutablearray *storedcellnumbers = [[managedobjectcontext executefetchrequest:fetchrequest error:nil] mutablecopy];         nsstring *cellnumber = [nsstring stringwithformat:@"%@", [storedcellnumbers valueforkey:@"youowecellnum"]];         [[uiapplication sharedapplication] openurl:[nsurl urlwithstring:cellnumber]];      }      else if (indexpath.section == 1)     {         nsmanagedobjectcontext *managedobjectcontext = [self managedobjectcontext];         nsfetchrequest *myfetchrequest = [[nsfetchrequest alloc]     initwithentityname:@"theyowemoney"];         nsmutablearray *storedcellnums = [[managedobjectcontext executefetchrequest:myfetchrequest error:nil] mutablecopy];         nsstring *thecellnumber = [nsstring stringwithformat:@"%@", [storedcellnums valueforkey:@"theyowecellnum"]];         [[uiapplication sharedapplication] openurl:[nsurl urlwithstring:thecellnumber]];      } } 

but far when user taps on cell nothing happens. i'm not sure what's going on. made sure cell number saved here:

nsmanagedobjectcontext *context =  [self managedobjectcontext]; owedmoney *owedmoney = [nsentitydescription insertnewobjectforentityforname:@"owedmoney" inmanagedobjectcontext:context]; [owedmoney setvalue:self.cellnum.text forkey:@"youowecellnum"]; 

all appreciated, in advance

be sure you've set table's delegate.

if you've created table view in interface builder, can right click on , click drag "delegate" file want delegate tableview.

otherwise, it's simple this:

mytableview.delegate = somedelegateobject; 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -