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!!!
I know zip about iPhone App development - still downloading these & like what I see. Look forward to new vids!
artfoundry1 1 week ago
Nice work. I was hooked! I'm hoping that new ones will be coming
DadioOnTheGo 3 weeks ago
Hey where can I find your next videos?
TheSravanthi1411 3 weeks ago
nice video but how to add it on my ipod??
floriscope 1 month ago
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?
amirafzaal 1 month ago in playlist More videos from RubyA1234
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 :)
TheJakeharold 1 month ago
I have gone through all 8 tutorials and I must thank you VERY MUCH. They are clear, logical, and of consistent quality!
slipshod99 1 month ago in playlist More videos from RubyA1234
These are the very best tutorials I have seen, it is starting to make real practical sence to me now, thank you
demphonic 1 month ago
- (IBAction) whenSwitched{ if(rubySwitch.on) { switchLabel.backgroundColor = [UIColor greenColor]; } else { switchLabel.backgroundColor = [UIColor blueColor]; }
}
dazlmAz 1 month ago
wow this really helped but can you do it on a windows vista?
DaFunkyMonkeys101 1 month ago