Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Hamza Ansari
1,014 PointsHow can I display poll results upon voting?
I'm writing an app where users can take different polls and view the results of each poll after submitting their vote, but I don't know how to display the results in the app after the user submits their vote. I'm using the Parse Starter Project template and I have the function written for a single voting option (each option takes the form of a button, which submits a vote for that option). This code works, but when I press a button on iOS simulator, I get a message that says, "Thread 1: breakpoint 1.1" in the ViewController.h file on the @property line. Here is the code I have written so far in my ViewController.m file:
- (NSString *) addVote:(NSString *) countOption1 {
NSString *result = [countOption1
stringByAppendingString:countOption1];
return result;
}
- (IBAction)addOneVote {
[self addVote: self.countOption1.text];
}
@synthesize countOption1;
And here is the code I've written in my ViewController.h file:
@property (weak, nonatomic) IBOutlet UILabel*
countOption1;
Do I need to make it so that the votes are submitted to my Parse.com cloud storage? How do I do that, and how do I make it so that the votes are counted and the results for each poll is displayed upon each vote?