Discussion Forums  >  Uncategorized

Replies: 13    Views: 445

Irishaisle
Aspiring developer
Profile
Posts: 53
Reg: Nov 22, 2010
location unknow...
530
12/05/10 08:55 AM (15 years ago)

Main Image

When you click the main image, some of your apps swing around and show a separate image. How can I make my apps image swing around a show a separate image? Where does that image reside in the code?
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
12/05/10 12:35 PM (15 years ago)
The app's main image on the home screen does transition when tapped, but only on the iOS version. The Android version doesn't do this. When it transitions, it slides in the 'info screen.' It doesn't slide in another image, it's the same image and then the info screen. If you want to change this, you could. If you have some understanding of the source code, it would be really easy. If you have zero understanding of the source code, it would be difficult. Let me know how interested you are in digging around the source and I'll guide if you want. Else, wait till v1.5 where options like these are almost endlessly configurable without code ;-)
 
Irishaisle
Aspiring developer
Profile
Posts: 53
Reg: Nov 22, 2010
location unknow...
530
like
12/05/10 02:38 PM (15 years ago)
I think that I can figure out the code if you lead me in the right direction. When will v1.5 be coming out? Thanks
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
12/05/10 03:42 PM (15 years ago)
v.1.5 for iOS is maybe a week or 10 days away? Charging hard on this. Android will follow and normally takes a few weeks to port over after doing the iOS version. We always start with the iOS release because Apple fans dominate our user base. For the image tap routine, have a look at AppViewController in the /ScreenControllers/Application folder. Look for the transitionImage method. This is the method that fires when the image is tapped.
 
Irishaisle
Aspiring developer
Profile
Posts: 53
Reg: Nov 22, 2010
location unknow...
530
like
12/05/10 05:01 PM (15 years ago)
Maybe I will wait for v1.5 then. I looked at the code and found the method but I wouldn't know what to change. Would it be just one line of code there where I would call the new (back) image from the image folder? My guess (and an uneducated guess) would be to change the setAnimationDelegate to something other than self? I downloaded a few of your apps and when you tap the image, it turns around to a Buzztouch image, and stays there... it doesnt go to the info section. This is something that I would like to accomplish... just a turnaround of images back and forth.
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
12/05/10 05:20 PM (15 years ago)
Ah, got it, I misunderstood. Yes, there are some older lingering versions that do exactly that - show another image, forgot about those, wink. This is easy and I'm sure you can pull it off. a) Drag the image you want to show into your Xcode project. b) Find the show info method in AppViewController.m Overwrite it with this.... -(void)showInfo{ //the other image from the project, give it rounded corners... UIImage *myOtherImage = [RoundImage makeRoundCornerImage:[UIImage imageNamed:@myOtherImage.png]:6:6]; if(appImageView.image = self.appImage){ [appImageView setImage:myOtherImage]; }else{ [appImageView setImage:[self appImage]]; } } Let me know if this makes sense. There may be a syntax error but that should work. The idea is simple: If the app's image is showing, switch it to the other image, else, show the app's image. The showInfo method is called after the flip transition is complete. This means the new image may not 'switch' exactly at the right time. It seems like it would switch right in the middle of the transition so the user didn't notice or something? Maybe experiment a little to see how it works. If this isn't quite right, you could have an 'empty' showInfo method that didn't do anything, then move the image switch code into the transitionImage() method? Just may take a bit of tinkering.
 
Irishaisle
Aspiring developer
Profile
Posts: 53
Reg: Nov 22, 2010
location unknow...
530
like
12/05/10 06:33 PM (15 years ago)
I tried it in both methods and got the same error Expected expression before '@' token. Here is how I had it in the transitionImage method. Also, i put the image2 in the /images/interface folder...was this correct. the image is named image2.png //transition image -(void)transitionImage{ animation types for flip image UIViewAnimationTransitionNone, UIViewAnimationTransitionFlipFromLeft, UIViewAnimationTransitionFlipFromRight UIViewAnimationTransitionCurlUp, UIViewAnimationTransitionCurlDown */ //the other image from the project, give it rounded corners... UIImage *image2 = [RoundImage makeRoundCornerImage:[UIImage imageNamed:@image2.png]:6:6]; if(appImageView.image = self.appImage){ [appImageView setImage:image2]; }else{ [appImageView setImage:[self appImage]]; } [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:.75]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDelegate:self]; [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:myHeaderView cache:YES]; //if we tapped image (different than flip after data init); if(flipAfterTransition == 1){ //re-set flag flipAfterTransition = 0; [UIView setAnimationDidStopSelector:@selector(showInfo)]; } [UIView commitAnimations]; }
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
12/05/10 07:41 PM (15 years ago)
Try putting quotes around the image name. This screen (this thread I'm typing in) removes some characters that are dissallowed in posts so I'm not totally sure what you actually see in Xcode. But, in Xcode, the imageNamed command expects: @'image2.png' The quotes in Xcode should be double quotes. One after the @ and one after png.
 
Irishaisle
Aspiring developer
Profile
Posts: 53
Reg: Nov 22, 2010
location unknow...
530
like
12/06/10 06:54 AM (15 years ago)
OK... I'm almost there! Now when I tap the image, it turns around to image2... but then if I tap it again, it makes the turn but stays with image 2. I am thinking the if statement needs a nested if??? I played around with it but couldn't get the right syntax. Also, I did empty the showInfo method but now when I tap the i button in the upper right corner, it does nothing. Is there a quick snippet that I can put in that method that just opens the about screen?
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
12/06/10 10:29 AM (15 years ago)
Laughing. I literally woke up in the night and thought, oh crap, the info button's not going to do anything now! Funny. Info button: in the .h file (AppViewController.h), list the protocol for a new method under where the other's are -(void)myNewShowInfoMethod(); Then, in the .m, make the method that shows the info screen -(void)myNewShowInfoMethod(){ yourAppDelegateName *appDelegate = (yourAppDelegateName *)[[UIApplication sharedApplication] delegate]; [appDelegate showAppInfo:[self application]]; } Tell the info button to use this method on the tap instead of the older method. Find this and change the name of the method from 'showInfo' to 'myNewShowInfoMethod' [infoButton addTarget:self action:@selector(showInfo) forControlEvents:UIControlEventTouchUpInside]; That should fix the button. As far as the image goes, maybe this is better. In the .h file, create a property to track what image is showing like: int whatImage; In the .m, when the image is tapped, do this... if(self.whatImage = 2){ //set the image to the new image [appImageView setImage:[UImage imageNamed:@'yourimagename.png']]]; //flag this so we know it's showing the second image self.whatImage = 1; }else{ //show the app's image [appImageView setImage.appImage] } It should show the second image the first time it's tapped, then the apps image the next time, and so on.
 
Irishaisle
Aspiring developer
Profile
Posts: 53
Reg: Nov 22, 2010
location unknow...
530
like
12/06/10 05:25 PM (15 years ago)
Got the info part to work correctly but i'm completely confused with the new if statements. Where do I put it? Do I get rid of the other if statement that we added to the transition method? I created whatImage in .h Does whatImage have to be set to something before asking it if it equals 2? SOOO close!!!
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
12/06/10 11:54 PM (15 years ago)
Code snippet from AppViewController.h NSString *localDataFileName; NSString *remoteDataCommand; int whatImage; } @property (nonatomic) int whatImage; @property (nonatomic, retain) Application *application; @property (nonatomic, retain) Application *updatedApplication; Notice I created a new property called whatImage, it's expecting an integer value in the .m file at some point. We do not need to initialize a value for it anywhere. Then, AppViewController.com the showInfo method (that really means 'show other image' because we are re-purposing this method)... it should look like.. -(void)showInfo{ //if the whatImage value is not equal to 2 (it defaults to nil), the app image is showing, show the other image if(whatImage != 2){ //show the other image, then set the value to 2 so next time it switches [appImageView setImage:[UImage imageNamed:@'yourimagename.png']]]; self.whatImage = 1; }else{ //show the second image, then reset the value to 2 for next time [appImageView setImage.appImage]; self.whatImage = 2; } } If you can't get this to work, don't pull your hair out. Send the .h and the .m files to info 'at' buzztouch.com, i'll fix it up for ya.
 
Irishaisle
Aspiring developer
Profile
Posts: 53
Reg: Nov 22, 2010
location unknow...
530
like
12/08/10 07:57 PM (15 years ago)
Just sent you the .h file. Still getting errors. Thanks David Oh wait... Could be the spelling ... Should be UIImage not UImage right?
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
12/09/10 12:55 AM (15 years ago)
Check out the email I sent you, you're all fixed up.
 

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.