Is this possible? I have a Data.m and Categories.m files, and I want a delete button that removes all Data and Categories, which are stored as NSMutableArrays in their respective files. Is this possible, with the one button? Thanks…
If you create a subclass of NSObject, and write an action that performs those two methods, (i.e. [dataArray setContent:nil];) for each array and then connect the action to the button in IB. Just off the top of my head maybe this will work for you:
[dataArray setContent:nil]; [categoryArray setContent:nil];
Let me explain to be a little clearer. I have arrays in the NSUserDefaults, and they are made into NSMutableArray
Well, Logan’s idea basically does just that, except that dataArray and categoryArray need to be changed to dataController and categoryController. These two variables should be IBOutlet
I think the idea here is not to have a button that has 2 actions, as interface builder is not going to let you. Logan’s idea is essentially the only way to do it. While your button cannot have 2 actions, an NSObject can have a method that does 2 things (or as many things as you want it to). So to simplify what Logan and JediKnil said, Your button CANNOT have 2 actions, BUT, your button can access an object that will access both of those .m files for you. –FreedomDumlao
Or, put another way, your button’s one action can call any other actions it wants.