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

obey me
1,135 PointsLike & Comment in UITableViewFooter
UIButton button = (UIButton *)[cell viewWithTag:100]; [button addTarget:self action:@selector(MethodName:) forControlEvents:UIControlEventTouchUpInside]; -(void)yourButtonClicked:(UIButton)sender { if (sender.tag == 0) { // i dont know what to here } }
1 Answer
Kai Aldag
Courses Plus Student 13,560 PointsHello,
are you liking a PFObject, if so I would recommend you make a relation where a post has an association to all the users liking it. so, in you selector method I would add something like,
PFRelation *like= [/*some post object*/ relationForKey:@"like"];
[like addObject:[PFUser currentUser]];
[like saveInBackground];
something like that. check out anypic from parse, it has a great example on how to do this.
Best, Kai
obey me
1,135 Pointsobey me
1,135 Pointswhat about a comment button do you have any sample code
Kai Aldag
Courses Plus Student 13,560 PointsKai Aldag
Courses Plus Student 13,560 PointsHmmm, a comment should have a user who posted it along with some string containing the comment message. so what you could do is something like,
this is something off the top of my head but it should work, once again, parse has a great example called anypic that should help alot.
Best, Kai
obey me
1,135 Pointsobey me
1,135 Pointsso the logic behind the comment button is basically when the button is tapped it shows a small uiview or uitableviewcell then we have a textfield to input the comments then we use a uilabel to display under right .. if you can please show me a sample code i am trying to get this part for over a month now
Kai Aldag
Courses Plus Student 13,560 PointsKai Aldag
Courses Plus Student 13,560 PointsOK i see, so when we hit a button we'll trigger an action to display the textField for input then when they hit post we'll use the code above. to do this, when the button is tapped we'll do something like this,
let me know if you have thing that need to be moved around because I can help you out with that part too.
obey me
1,135 Pointsobey me
1,135 Pointsbut which one is better to use the UIView or UItableview
Kai Aldag
Courses Plus Student 13,560 PointsKai Aldag
Courses Plus Student 13,560 PointsIf you're showing multiple posts i'd use a tableView (i personally use collectionViews for more customization) and a UIView for something like a single post.
Kai Aldag
Courses Plus Student 13,560 PointsKai Aldag
Courses Plus Student 13,560 PointsDid this do it?
obey me
1,135 Pointsobey me
1,135 Pointsyeah i text u on twitter Kai Aldag