trouty
I hate code!
Profile
Posts: 338
Reg: Mar 26, 2013
London Outskirt...
4,830
05/27/13 03:58 PM (12 years ago)

Scringo and MacImageGallery

Been trying (unsuccessfully) to get a scringo 'like' button into my gallery so a user can like an image and it posts to the scringo activity feed (with a thumbnail image). Anyone had any luck with this? cheers
 
Absentia
buzztouch Evangelist
Profile
Posts: 960
Reg: Oct 20, 2011
Alaska
20,600
like
05/27/13 08:18 PM (12 years ago)
Yep, try this - Go to Mac_image_gallery.m and find the "-(void)updateNavigation" method (should be somewhere around line 950). Inside that method find the line of code that looks like this - //figure out the image's title (assume we don't have one)... BT_item *thisImage = [self.imageList objectAtIndex:currentPageIndex]; Post all of the following code directly BELOW that line - NSString *likeIt = [thisImage.jsonVars objectForKey:@"imageURL"]; ScringoLikeButton *likeButton = [[ScringoLikeButton alloc] initWithFrame:CGRectMake(40, 300, 50, 27)]; UIBarButtonItem *likeItButton = [[UIBarButtonItem alloc] initWithCustomView:likeButton]; //UNCOMMENT FOR TAB BAR LAYOUT /*((UINavigationController*)[appDelegate.rootApp.rootTabBarController.viewControllers objectAtIndex: 3]).navigationBar.topItem.rightBarButtonItem = likeItButton; */ //UNCOMMENT FOR NON TAB BAR LAYOUT /*((UINavigationController*)[appDelegate.rootApp.rootNavController.retain retain ]).navigationBar.topItem.rightBarButtonItems = [NSArray arrayWithObjects:[ScringoAgent scringoActivationBarItem], likeItButton, nil]; */ [likeButton updateLikeObject:likeIt type:SCRINGO_APP_LIKE_IMAGE description:@"My Awesome Pic"]; A few notes about the above code - I've included code for tab bar and non tab bar layouts because I'm not sure which you're using. To uncomment just remove the /* at the beginning and the */ at the end. If you are using a tab bar layout be sure to specify which tab to show the button in. If you look at the above code where it says "objectAtIndex: 3" - that means it will show in the 4th tab. (The tabs are numbered 0-4) Simply change it to whichever tab number your image gallery is located under. Also, you'll most likely want to replace the like image description with something of your own choosing. Let me know if it works out
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
05/27/13 10:27 PM (12 years ago)
Thanks Absentia, I'll give it a whirl soon as well! cheers ian
 
trouty
I hate code!
Profile
Posts: 338
Reg: Mar 26, 2013
London Outskirt...
4,830
like
05/27/13 10:38 PM (12 years ago)
cool... but i get error: use of undeclared identifier appdelegate hmmm
 
Absentia
buzztouch Evangelist
Profile
Posts: 960
Reg: Oct 20, 2011
Alaska
20,600
like
05/27/13 10:55 PM (12 years ago)
Ah, I suppose I missed a step..well that's an easy enough fix - There's a block of code that appears all over the place in your project that references the app delegate. This is what mine looks like - //appDelegate onedirectionv2_appDelegate *appDelegate = (onedirectionv2_appDelegate *)[[UIApplication sharedApplication] delegate]; The block of code will look exactly the same in your project except, obviously, "onedirectionv2" will be replaced with whatever your project name is. You should find your own occurence of that code in a plugins "view will appear" method. Find that code and paste it at the top of the updateNavigation method
 
trouty
I hate code!
Profile
Posts: 338
Reg: Mar 26, 2013
London Outskirt...
4,830
like
05/28/13 02:13 PM (12 years ago)
Ill sit down and work thru it when I next get a chance of some me time.. Cheers :-)
 

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.