Lesson 8 How To Build iPad iPhone Apps iOS Xcode SDK Application Development Tutorials

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
4,113
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Jul 25, 2011

Lesson 8 | Adding Interactivity Into your App | Switch Button and Label Colours.

Steps:
1 - Create the objects in the view controller
2 - Define these objects in .h file
3 - Define the action in .h file
4 - Implement the action in .m file
5 - Connect the objects and actions in Inspector (File Owner)
6 - Build & Run

in the .h file these are the codes...

IBOutlet UISwitch *yourswitchname;
IBOutlet UILabel *yourswitchlabelname;

- (IBAction) whenswitchischanged;

In the .m file, these are the codes..

- (IBAction) whenswitchischanged{
if(yourswitchname.on){
yourswitchlabelname.backgroundColor = [UIColor greenColor];
} else {
yourswitchlabelname.backgroundColor = [UIColor redColor];
}
}

Have Fun!!!

  • likes, 0 dislikes

Link to this comment:

Share to:
see all

All Comments (31)

Sign In or Sign Up now to post a comment!
  • I know zip about iPhone App development - still downloading these & like what I see. Look forward to new vids!

  • Nice work. I was hooked! I'm hoping that new ones will be coming

  • Hey where can I find your next videos?

  • nice video but how to add it on my ipod??

  • Hi Vineet, I watched all your 8 videos, these are helpful and precise to understandable for beginners. Don't you have plan to upload more?

  • You're videos are exceptional for people new to this stuff. You explain things really well to beginners, very thorough. I need more!

    I was wondering if there is any way of contacting you to ask about specific problems? My email is jake.t.harold@gmail.com

    I'm trying to make an app that views pages of a comic, downloads new pages as 'updates', lets users flick through pages and set a bookmark were were they've read to. I was full or worry an hour ago, now I'm full of optimism :)

  • I have gone through all 8 tutorials and I must thank you VERY MUCH. They are clear, logical, and of consistent quality!

  • These are the very best tutorials I have seen, it is starting to make real practical sence to me now, thank you

  • - (IBAction) whenSwitched{ if(rubySwitch.on) { switchLabel.backgroundColor = [UIColor greenColor]; } else { switchLabel.backgroundColor = [UIColor blueColor]; }

    }

  • wow this really helped but can you do it on a windows vista?

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more