objective c - Creating an array of objects, from multiple buttons in IB, XCode -


I have to have three sets of 10 buttons for an iOS app. I want to show / hide each set (reveal one set at a time) I am planning to use the tag to do this.

Because I have a property for each button (ex: BTN 01, BTN 02, etc.), so I have 30 properties. I add it to an array, and then use the following code to hide the button with one tag or another

My question is, instead of setting 30 properties (one for each button) There is a more effective way of creating an array of objects. That's fine, just a surprising way to get a surprise by using a loop to collect every button from the IB. Can not think about it.

  if (tagState == 1) {tagState = 2; } Else {tagState = 1; } (BRN in Meyer) {NSLog (@ "% @", BTN); If (tagState == 1) {if (btn.tag == 1) {[BTN sethead: yes]; } If (BTnTag == 2) {[BTN set hasaid: NO]; }} And if (tagstate == 2) {if (btn.tag == 1) {[BTN SetHind: No]; } If (BTnTag == 2) {[BTN set hipped: yes]; }}}}}}  

I think you can use the visual hierarchy here very effectively: put your own < In the code> UIView , connect the outlets to each group of buttons, only three UIView , and show them Note that this only works when you There is no need to reach the individual buttons for any other reason.

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -