cocoa touch - fetching data from tableview cell? -


god evening :-d

i have a tableview,(using core data) pub cell "todo" like: "5 mile run" , set detailed text @"points value @", x x number set slider, , same time u set name todo.

i have put in button in cell, , called add, , want able add number in detailed text "totalpoints" attribute in core data model.

i can make fetchrequest entity,but how make sure number, , how use simple math when "pointvalue" stored in nsnumber object.

update :

fixed :-d

if u add button cell, u can indexpath :

- (ibaction)buttontapped:(id)sender {   if (![sender iskindofclass: [uibutton class]]) return;    uitableviewcell *cell = (uitableviewcell *)[sender superview]; if (![cell iskindofclass: [uitableviewcell class]]) return;    nsindexpath *indexpath = [self.tableview indexpathforcell: cell];  // indexpath.row and/or indexpath.section. 

this fixed app, , it´s in beta testing :-p

thanks

skov

in sample code, there couple issues. first, when getting values a, b , e can this:

nsnumber *a = todo.pointsvalue; 

(assuming todo.pointsvalue nsnumber).

secondly, in if statement comparing values of pointers, not values in objects pointers point to.

this code should have result want (i assume initialize todo in way) :

todo *todo; cgfloat x = [todo.pointsvalue floatvalue] + [todo.totalpoint floatvalue]; //note: better use cgfloat rather plain float cgfloat y = [todo.goodiespoints floatvalue]; if (x >= y) {     [self performselector:@selector(winview)                 withobject:nil                 afterdelay:0.5]; } 

i not sure mean when "how make sure number". number "that number"?


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -