Tuesday, 17 September 2013

add value into NSMutableArray from UILabel

add value into NSMutableArray from UILabel

I don't know why I can't add value into NSMutableArray from UILabel.
I have this:
ViewController.h
- (IBAction)addPedido:(id)sender;
@property (strong, nonatomic) NSMutableArray *pedidoArray;
@property (strong, nonatomic) IBOutlet UIButton *btnBebida3;
@property (retain, nonatomic) IBOutlet UILabel *txtBebida3;
ViewController.m
@synthesize pedidoArray,btnBebida3,txtBebida3;
- (IBAction)addPedido:(id)sender {
NSString *teste = self.txtBebida3.text;
[pedidoArray addObject:teste];
NSLog(@"todos os valores: %@", pedidoArray);
}
Why when I click on the button my array is null?
tks

No comments:

Post a Comment