Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 7    Views: 109

Alex@TM
Apple Fan
Profile
Posts: 956
Reg: Dec 20, 2011
London, UK
10,560
04/04/13 02:04 PM (12 years ago)

Customizing MacImage Gallery

Keith might be best placed to answer this but feel free to have a stab if you can help out! I'm trying to customize the gallery so that the arrow button used for saving and emailing the images from the action sheet have more buttons added, such as sharing to facebook and twitter from there. It seems to make more sense than to add to another window altogether. Now, I have found the code, eg... //possible email image button if([[BT_strings getJsonPropertyValue:self.screenData.jsonVars nameOfProperty:@"showEmailImageButton" defaultValue:@"0"] isEqualToString:@"1"]){ [buttons addObject:NSLocalizedString(@"emailImage", "Email Image")]; } What i'm struggling with is where the emailImage are referenced. I was expecting them to be in the .h but i'm missing something obvious I know! I can add another 'Email...' Button by simply copying this code but, naturally, adding 'tweetImage' does nothing as it is not referenced. I'm pretty sure I can adapt the code in the button action to get the tweet sheet to appear but stumped at the first hurdle. Thanks for reading and helping out! All the best.
 
Alex@TM
Apple Fan
Profile
Posts: 956
Reg: Dec 20, 2011
London, UK
10,560
like
04/04/13 04:20 PM (12 years ago)
So basically what i'm trying to achieve is to add more buttons to the action sheet :)
 
nadthevlad
Code is Art
Profile
Posts: 1025
Reg: Jun 07, 2012
Denver
21,850
like
04/04/13 06:14 PM (12 years ago)
You found the right part for the email button. Look below that a few lines at the //add the buttons This for loop puts that button onto the action sheet. The a little bit below that at line 1019 is where the button press actions are. // action sheet for button click confirmations -(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { // some code } This is where you set up each button in the action sheet to call their related function. This doesn't show up in the .h file because you are overriding an already existing function. The BT-quiz plugin uses this same setup with the action sheet. Look there for another example.
 
nadthevlad
Code is Art
Profile
Posts: 1025
Reg: Jun 07, 2012
Denver
21,850
like
04/04/13 06:19 PM (12 years ago)
This is from the BT_screen_quiz.m This one is a little bit easier to digest. You can see where each button press is associated with a function call. //delegate method for action sheet clicks -(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { NSString *buttonTitle = [actionSheet buttonTitleAtIndex:buttonIndex]; //quit if([buttonTitle isEqual:NSLocalizedString(@"quit", @"Quit")]){ [self navLeftTap]; } //show reward if([buttonTitle isEqual:NSLocalizedString(@"quizShowReward", @"Show Reward")]){ [self showQuizRewardScreen]; } //show continue if([buttonTitle isEqual:NSLocalizedString(@"continue", @"Continue")]){ [self showFinishScreen]; } //try again if([buttonTitle isEqual:NSLocalizedString(@"quizTryAgain", @"Try Again")]){ [self startQuiz]; } }
 
Alex@TM
Apple Fan
Profile
Posts: 956
Reg: Dec 20, 2011
London, UK
10,560
like
04/04/13 06:35 PM (12 years ago)
Great, thanks a lot. I will take a look in the morning and report back. Very grateful, cheers.
 
Alex@TM
Apple Fan
Profile
Posts: 956
Reg: Dec 20, 2011
London, UK
10,560
like
04/05/13 01:09 AM (12 years ago)
Sorry, was being a bit slow! Realised I needed to add 'showTweetButton' in the JSON. Now works fine, opens in the Action Sheet and Tweet Sheet Happily opens from there. Just the small matter of adding the relevant image to the tweet sheet now!
 
nadthevlad
Code is Art
Profile
Posts: 1025
Reg: Jun 07, 2012
Denver
21,850
like
04/05/13 01:30 AM (12 years ago)
Which ones are you trying to add? Just the Tweet Sheet?
 
Alex@TM
Apple Fan
Profile
Posts: 956
Reg: Dec 20, 2011
London, UK
10,560
like
04/05/13 01:39 AM (12 years ago)
Yup, trying to add the relevant image in the gallery to the tweet sheet. Usually use the following [tweetSheet addImage: [imageView image]];
 

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.