Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 4    Views: 112

mleonard
Apple Fan
Profile
Posts: 124
Reg: Nov 01, 2011
Conway,AR
1,940
06/10/13 07:08 PM (12 years ago)

Thumb Viewer Plugin & Scringo - like button (working, kinda)

Well I have the Thumb Viewer plugin working with Scringo, like button & updating the Activity feed and everything (took forever to figure that out). Running into a couple of issues: After clicking "show me the images" you see the thumbnails, then you click on an image and it goes full screen. At this point, the like button appears and functions properly. BUT the like button is covering up the "see all" button, so I can't get back to the thumbnails. (for now I've unhid the "Back" button so I can at least get back to the main screen. Also, once hitting back, the like button still appears on the main screen with the "show me the images" button (I'm assuming because they are in the same view controller) Does this make sense haha? And does anyone have a solution or idea on how to fix both/either of these issues?
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
06/10/13 11:29 PM (12 years ago)
Any guide or tutorial for getting this to work.
 
mleonard
Apple Fan
Profile
Posts: 124
Reg: Nov 01, 2011
Conway,AR
1,940
like
06/11/13 09:29 AM (12 years ago)
Here's the best I can remember: I used @Absentia's code from this post and modified: http://www.buzztouch.com/forum/thread.php?tid=7B0DA80CAC0517FFF3147B5&fid=F006D74B653CA9FFE3CB28E In FGalleryViewController.m #import <Scringo/ScringoAgent.h> #import <Scringo/ScringoLikeButton.h> Then underneath this line: if( photo == nil ) photo = [self createGalleryPhotoForIndex:index]; [photo loadFullsize]; Paste this: //appDelegate YOURAPPNAMEHERE_appDelegate *appDelegate = (screenshot_appDelegate *)[[UIApplication sharedApplication] delegate]; NSString *likeIt = [_photoSource photoGallery:self urlForPhotoSize:FGalleryPhotoSizeFullsize atIndex:index]; 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"]; This is also from @ Absentia's post 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 Also, be sure and put your app delegate on the first line...I may be missing something, but I think that will get it working.
 
PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
like
06/12/13 05:15 AM (12 years ago)
 
mysps
Code is Art
Profile
Posts: 2082
Reg: May 14, 2011
Palma
33,320
like
07/01/13 05:42 PM (12 years ago)
@mleonard i'm trying to use the code above and also the optimized code and fix by PSMDanny but I'm getting a crash everytime I try to view the next photo. It also seems as all of the likes are for the same image. i'm kind of stumped :/ Any ideas?! My error code is: *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 1 beyond bounds [0 .. 0]' Here is my code using non tabs - (void)loadFullsizeImageWithIndex:(NSUInteger)index { FGalleryPhoto *photo = [_photoLoaders objectForKey:[NSString stringWithFormat:@"%i", index]]; if( photo == nil ) photo = [self createGalleryPhotoForIndex:index]; [photo loadFullsize]; //appDelegate myapp_appDelegate *appDelegate = (myapp_appDelegate *)[[UIApplication sharedApplication] delegate]; NSString *likeIt = [_photoSource photoGallery:self urlForPhotoSize:FGalleryPhotoSizeFullsize atIndex:index]; 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"]; } --- 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.