Advertise here

Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Multiple UISwitch to have a numeric value if on

Jp4RealJp4Real Posts: 3New Users Noob
edited April 2015 in iOS SDK Development
Hi all

Now I'm trying to write my first app

I've spent multiple days on this now I need to create an app that does this

When a uiswitch is ON it has a specific value,
all those values are totalized at the bottom of the app in a Label (Showing the amount)

I am very new to coding and to Xcode more specifically, I had an excel sheet with checkboxes that was doing exactly that (except switches were checkboxes)

Now I don't know were to go I've read tutorials to create an app, tried in playground a bit tried in the app itself but can't find this !! specifically IN a tableview seems to be a lot more complicated

I'm using swift BTW

I thought this king of app would be easy but I was so soooo wrong

thanks a lot in advance !


  • BrianSlickBrianSlick Treadmill Desk Ninja Posts: 10,692Tutorial Authors, Registered Users @ @ @ @ @ @ @ @
    It's not necessarily hard to do, but there is a lot that you have to know in order to pull it off. So your best bet is to find a good introductory book on iOS development and start learning. You will have to be patient, this is not something you will learn how to do in the next day or two. Think in terms of weeks or possibly even months.
    Professional iOS App Development. Available for hire.
    BriTer Ideas LLC - WWW | Facebook | Twitter | LinkedIn

    BTIKit | SlickShopper 2 | Leave a PayPal donation
  • Jp4RealJp4Real Posts: 3New Users Noob
    OK well thanks for your answer,

    I thought I could put it as a subclass of UIswitch and make it a method for it

    anyway I'll keep reading
  • Jp4RealJp4Real Posts: 3New Users Noob
    Hey All

    I read a lot and there is something I can't figure out

    when I add my switch in my tableviewcell in my story board I can't link it to the view controller (which is ok since my tableview is already linked)

    Now I read that I have to add It to the cells programmaticly using accessoryview

    thing is I did some code and nothing shows up in it

    any help would be appreciated

    thanks a lot
  • RickSDKRickSDK Posts: 1,240Registered Users @ @ @ @
    sorry but your coding problems are sort of all over the place and mostly the result of simply not playing around with objective c enough.

    If you need a bunch of switches on a view you can create separate properties for each. Or maybe create an NSArray property to store their values (although you might need to convert the bool values to string.

    If you are trying to put switches into a tableview cell, that's possible too but it requires creating a UITableViewCell and then there are a bunch of ways of adding a switch, but you still need to attach a selector to each switch to capture when they are thrown (or use the accessoryView). As you can see there are tons of options.

    Bottom line, you just need more time playing around with your Xcode. Your questions are too broad and can't be answered with a single solution.
Sign In or Register to comment.