• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Question about matrix of possibilities
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about matrix of possibilities


  • Subject: Re: Question about matrix of possibilities
  • From: Marco Tabini <email@hidden>
  • Date: Wed, 16 Oct 2013 13:09:28 -0400

On Oct 16, 2013, at 12:48 PM, Eric E. Dolecki <email@hidden> wrote:

> I've been asked to make a tableview with 8 rows. Each row has a UISwitch.
> Based on a combination of switch values, the result would be a different
> image displayed to the right of the table (this is for iPad).
>
> How would I best go about covering all of those combinations?
>
> When one switch changes I'll check it's on/off state and then run some
> evaluation method based on the values for all of the switches. How do I do
> that without getting too ugly about it?

There are a bunch of ways to handle this—for example, you can assign each switch a power-of-two value based on their index in the tableview's data source, and then add the ones that are on together; this will give you a separate number for each possible combination, which you can then use as the name of the corresponding image (0.png, 1.png … 255.png).
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Question about matrix of possibilities
      • From: Eric E Dolecki <email@hidden>
References: 
 >Question about matrix of possibilities (From: "Eric E. Dolecki" <email@hidden>)

  • Prev by Date: Re: Cocoa class extension best practice
  • Next by Date: Re: Core Data with ODBC databases?
  • Previous by thread: Question about matrix of possibilities
  • Next by thread: Re: Question about matrix of possibilities
  • Index(es):
    • Date
    • Thread