From the course: iOS and watchOS App Development: Notifications
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Use buttons for actions
From the course: iOS and watchOS App Development: Notifications
Use buttons for actions
- [Instructor] Okay, with our IB actions now in the code, we can go ahead and start putting together buttons and the first button we're going to do is a toggle on the like button to go on like and unlike again. And we'll also do that reflecting it a little bit in the action. So what we're going to do here is first I'm going to just get the like button started, and we're just going to do an if sender.titleLabel, and I'm going to put a question mark here 'cause it tends to get really cranky on me, and text equals like, in that case we're going to set the sender.setTitle, and the title will change to unlike for UI control state normal, and I'ma just do if it isn't that, we'll move it back to like. So I'm just going to do a Cmd + Copy here, Cmd + C, Cmd + V, and turn that to like. So that's the simplest thing that we can do, but I'd like to also have this reflect in my actions. So I can change my actions here too, from the button, and so what we're going to do is do an…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
-
(Locked)
Add the content extension1m 15s
-
(Locked)
Change the UI3m 53s
-
(Locked)
Code the view controller4m 9s
-
(Locked)
Change plist settings3m 6s
-
(Locked)
Customize actions3m 4s
-
(Locked)
Customize requests4m 15s
-
(Locked)
Add buttons2m 57s
-
(Locked)
Use buttons for actions3m 31s
-
(Locked)
Code the snooze button3m 57s
-
(Locked)
-
-
-