Nsmutablearray modifies elements, using -insertobject:atindex: and -replaceobjectatindex:withobject: All can, that is, by inserting ( Insert) and replacement (replace) can be implemented.
Example:
//Reduce button monitoring- (void) Onsubbtnpressed: (UIButton*) Sender {nidprintmethodname ();NsintegerTimes = [[_servicenumlist objectatindex:_servicepos] integervalue];if(Times <=1) {return; } times--;//Reduction //change array data[_servicenumlist Replaceobjectatindex:_servicepos withobject:[NSNumberNumberwithinteger:times]];//Set dataUitextfield *mo = [_timesfieldarray Objectatindex:_servicepos]; nsattributedstring* timestext =[[nsattributedstring Alloc] initwithstring:[NSStringstringwithformat:@"%ld", (Long) [[_servicenumlist Objectatindex:_servicepos] integervalue]];//Set text[Mo Setattributedtext:timestext]; _totalprice = (float) ([_goodslist[_servicepos][@"Price"] floatvalue]/100.0) *[[_servicenumlist Objectatindex:_servicepos] integervalue]; [_totalpricelabel settext:[NSStringstringwithformat:@"%0.1f", _totalprice]];}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Objective-c-Change specific elements of Nsmutablearray