This time I am having problems with not being able to store some data in an NSMutablearray.
The process is like this:
I click on a button that loads a UIPopOver and I make the selection of a product and its amount, through UIPIckerView, when I click the Done button, the amount, product and total price appears on a UITextView. I'm ok with that.
The problem is that I need to store each selection from the UIPickerView in the NSMutablearray for a later calculation of the sum of all products selected, but it is not storing in the NSMutablerarray.
So, anyone could help???
-(void)donePressed{
//Cálculo do valor a pagar
float quantFlt = [[arrayQtdProdutos objectAtIndex:[categoryPicker selectedRowInComponent:1]] floatValue];
float valorFlt = [[valorArray objectAtIndex:[categoryPicker selectedRowInComponent:0]] floatValue];
float total = quantFlt * valorFlt;
_msg = [NSString stringWithFormat: @"%@ - %@ - R$ %.2f",
[arrayQtdProdutos objectAtIndex:[categoryPicker selectedRowInComponent:1]],
[arrayOfCategories objectAtIndex:[categoryPicker selectedRowInComponent:0]],
total];
_txtViewProdutos.text = [NSString stringWithFormat:@"%@ \n%@", _txtViewProdutos.text, _msg];
[arrayProdutosComprados addObject:_msg];
NSLog(@"%i", arrayProdutosComprados.count);
[popOverController dismissPopoverAnimated:YES];
}
msg? Is it supposed to be a property?msgI suspect that its going to be nil. So again, is it supposed to be a property?@property (strong, nonatomic) NSString *msgthen changemsg =toself.msg =And when you want to use it callself.msg