Absentia
buzztouch Evangelist
Profile
Posts: 960
Reg: Oct 20, 2011
Alaska
20,600
08/21/13 04:53 PM (10 years ago)

Tutorial: Social image gallery with Scringo

Hey guys, I haven't been posting much these days - seems like the more apps I get out there, the bigger my update to-do list grows. Anyway, I don't know if anybody noticed, but Scringo just released a new SDK version that allows you to add a comment button to pretty much anything in your app! This was my favorite feature with Socialize so I'm really excited to see that Scringo finally has it. I'm always seeing posts (and getting private messages) asking about adding the Scringo like button to the MacImage Gallery, so I'm just going to make this the official thread for it. This is a super quick tutorial that should make it easy for anybody to add both a like button and a comment button to each image in their MacImage Gallery. A couple requirements: 1. Xcode (this is an iOS tutorial) 2. The most recent version of the Socialize SDK - the comment button feature was introduced in version 2.3.3 3. The MacImage Gallery plugin - http://www.buzztouch.com/plugins/plugin.php?pid=EB6FD85F45591F795E530D0 4. The images in your MacImage Gallery must be hosted somewhere - this tutorial won't work for images that are stored in your project ----- Instructions ------ STEP 1. Paste the following imports in Mac_image_gallery.m - #import <Scringo/ScringoAgent.h> #import <Scringo/ScringoLikeButton.h> #import <Scringo/ScringoCommentButton.h> picture for reference - https://www.dropbox.com/s/u7cddrzvt3ugnof/Screen%20Shot%202013-08-21%20at%203.17.18%20PM.png STEP 2. Find the "-(void)updateNavigation " method in Mac_image_gallery.m (should be around line 800). Then, inside of that method, find the following line of code - BT_item *thisImage = [self.imageList objectAtIndex:currentPageIndex]; Note: You can find this line of code super fast by clicking on the little magnifying glass in Xcode above your folder view. Then, just paste "[self.imageList objectAtIndex:currentPageIndex];" into the search box and hit enter STEP 3. Paste the following block of code directly AFTER the code shown above (in step 2) - NSString *commentPic = [thisImage.jsonVars objectForKey:@"imageURL"]; ScringoCommentButton *myCommentButton = [[ScringoCommentButton alloc] initWithFrame:CGRectMake(40, 300, 50, 27)]; [myCommentButton updateImageCommentObject:commentPic withTitle:@"Great Image !!"]; UIBarButtonItem *commentButton = [[UIBarButtonItem alloc] initWithCustomView:myCommentButton]; NSString *likeIt = [thisImage.jsonVars objectForKey:@"imageURL"]; ScringoLikeButton *likeButton = [[ScringoLikeButton alloc] initWithFrame:CGRectMake(40, 300, 50, 27)]; UIBarButtonItem *likeItButton = [[UIBarButtonItem alloc] initWithCustomView:likeButton]; [ScringoAgent setScringoActivationButtonType:(SCRINGO_BUTTON4)]; ((UINavigationController*)[appDelegate.rootApp.rootNavController.retain retain ]).navigationBar.topItem.rightBarButtonItems = [NSArray arrayWithObjects:commentButton, likeItButton, nil]; [likeButton updateLikeObject:likeIt type:SCRINGO_APP_LIKE_IMAGE description:@"a pic"]; picture for reference - https://www.dropbox.com/s/xwl0sy63a860tau/Screen%20Shot%202013-08-21%20at%203.16.42%20PM.png That's it! - hopefully this helps some people out Here's a couple screenshots of the final product - https://www.dropbox.com/s/iq71tuuetatnbh5/iOS%20Simulator%20Screen%20shot%20Aug%2021%2C%202013%203.55.30%20PM.png https://www.dropbox.com/s/ichgsv4q48ye34f/iOS%20Simulator%20Screen%20shot%20Aug%2021%2C%202013%203.55.34%20PM.png
 
SheriDee
Code is Art
Profile
Posts: 1094
Reg: Sep 23, 2011
location unknow...
22,840
like
08/21/13 04:54 PM (10 years ago)
SWEET! Thanks! You are the best!
 
MacApple
Apple Fan
Profile
Posts: 4674
Reg: Oct 25, 2010
USA
61,140
like
08/21/13 05:06 PM (10 years ago)
As always, you are the man. Was just emailing the Scringo chaps. Good stuff.
 
Uelsimon
Lost but trying
Profile
Posts: 272
Reg: Mar 25, 2012
NYC
4,470
like
08/21/13 05:37 PM (10 years ago)
Holy camole. Awesome sauce.
 
Pancho
Code is Art
Profile
Posts: 221
Reg: Mar 06, 2012
Lima
11,610
like
08/21/13 05:45 PM (10 years ago)
Abseeeeeeeentiaaaa... u da man!
 
mysps
Code is Art
Profile
Posts: 2082
Reg: May 14, 2011
Palma
33,320
like
08/21/13 09:45 PM (10 years ago)
Awesome share! Going to my Codebox!! love that app lol Thanks
 
Adam
Aspiring developer
Profile
Posts: 247
Reg: Oct 23, 2010
Southern Califo...
4,470
like
08/21/13 09:47 PM (10 years ago)
Is the code different for tabbed bar layout? I can't get it to work. I'm getting no errors. Thanks, Adam
 
Absentia
buzztouch Evangelist
Profile
Posts: 960
Reg: Oct 20, 2011
Alaska
20,600
like
08/21/13 09:57 PM (10 years ago)
Thanks guys - happy to help out the BT crew as usual :) @mysps - I never heard of Codebox, but after reading your post I checked it out and had to download it. I have been wanting an app like this and I didn't even know it existed - thanks for mentioning it! @Adam - oops, I always forget about tab layout. Yes the code is a little different - for tab layouts, just replace the code from Step 3 with the following - NSString *commentPic = [thisImage.jsonVars objectForKey:@"imageURL"]; ScringoCommentButton *myCommentButton = [[ScringoCommentButton alloc] initWithFrame:CGRectMake(40, 300, 50, 27)]; [myCommentButton updateImageCommentObject:commentPic withTitle:@"Great Image !!"]; UIBarButtonItem *commentButton = [[UIBarButtonItem alloc] initWithCustomView:myCommentButton]; NSString *likeIt = [thisImage.jsonVars objectForKey:@"imageURL"]; ScringoLikeButton *likeButton = [[ScringoLikeButton alloc] initWithFrame:CGRectMake(40, 300, 50, 27)]; UIBarButtonItem *likeItButton = [[UIBarButtonItem alloc] initWithCustomView:likeButton]; [ScringoAgent setScringoActivationButtonType:(SCRINGO_BUTTON4)]; ((UINavigationController*)[appDelegate.rootApp.rootTabBarController.viewControllers objectAtIndex: 3]).navigationBar.topItem.rightBarButtonItems = [NSArray arrayWithObjects:commentButton, likeItButton, nil]; [likeButton updateLikeObject:likeIt type:SCRINGO_APP_LIKE_IMAGE description:@"a pic"]; let me know if that works out
 
mysps
Code is Art
Profile
Posts: 2082
Reg: May 14, 2011
Palma
33,320
like
08/21/13 10:05 PM (10 years ago)
yeah! i found it thanks to another post in the forum: http://www.buzztouch.com/forum/thread.php?tid=07BAC438DE089C1E1CF83F5&currentPage=28 check out those others as well!
 
Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
like
08/21/13 10:05 PM (10 years ago)
Even though we missed meeting him on our recent trip to Alaska, the new profile picture allows a better glance at this seriously talented dude! :-) -- Niraj
 
Adam
Aspiring developer
Profile
Posts: 247
Reg: Oct 23, 2010
Southern Califo...
4,470
like
08/21/13 10:20 PM (10 years ago)
@Absentia Thank you it works. I appreciate the help. Thanks, Adam
 
AppOne
buzztouch Evangelist
Profile
Posts: 348
Reg: Apr 03, 2012
London
13,980
like
10/08/13 09:48 PM (10 years ago)
When I try to implement the code above using Xcode 5, I get the error: 'Use of undeclared identifier 'app.Delegate' for the following: ((UINavigationController*)[appDelegate.rootApp.rootNavController.retain retain ]).navigationBar.topItem.rightBarButtonItems = [NSArray arrayWithObjects:commentButton, likeItButton, nil]; Any ideas?
 
AppOne
buzztouch Evangelist
Profile
Posts: 348
Reg: Apr 03, 2012
London
13,980
like
10/08/13 11:10 PM (10 years ago)
 
mysps
Code is Art
Profile
Posts: 2082
Reg: May 14, 2011
Palma
33,320
like
01/03/14 08:43 AM (10 years ago)
Does anyone have this working in 3.0 core and that latest Scringo? The button doesn't show up at all in the top nav bar. Could it be of the transparency of the nav bar?
 
mysps
Code is Art
Profile
Posts: 2082
Reg: May 14, 2011
Palma
33,320
like
01/03/14 11:35 AM (10 years ago)
Wierd update... So I have the like button showing up in the Menu Image plugin.. I have no clue why, its so weird. I haven't updated the menu with image plugin at all but the like button shows there :/ Mystery..I'll contact the Scringo gang and report back.
 
Absentia
buzztouch Evangelist
Profile
Posts: 960
Reg: Oct 20, 2011
Alaska
20,600
like
01/03/14 10:59 PM (10 years ago)
I think I know what the issue probably is. From the issue your describing, it sounds like you have a tab bar layout and you are pointing to the wrong tab index. Find the part of the code where you implement that button that says "objectAtIndex" - the number following that line needs to be the same as the number of the tab that you want it to show it in keep in mind the first tab is 0, so if you have 4 tabs then the fourth tab will be objectAtIndex:3
 
mysps
Code is Art
Profile
Posts: 2082
Reg: May 14, 2011
Palma
33,320
like
01/04/14 03:10 AM (10 years ago)
yep.. thats what it was. i actually looked at that objectatindex but it didnt register. thanks!
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.