Discussion Forums  >  Uncategorized

Replies: 9    Views: 494

QuiggityBiggity
Aspiring developer
Profile
Posts: 38
Reg: Aug 05, 2011
Baltimore
980
10/10/11 10:16 AM (14 years ago)

xCode - Changing info icon after tapping on Location Map Pin

Anyone know how to change the info icon that pops up after tapping on a pin? I'd like to change it to an icon I made that says 'GO'.
 
Parker @ buzztouch
buzztouch Evangelist
Profile
Posts: 1395
Reg: May 09, 2011
Pacific Grove, ...
24,500
like
10/10/11 10:08 PM (14 years ago)
Hi QB, You'll have to do some code modification within xcode. If you open up the BT_screen_map.m file and scroll down to about line 557 you'll see where the button is created when 'show driving directions' is selected as the option for what happens when the button is pressed. Below that you'll see the code for when 'show details' is the option. So what you're going to want to do is replace the existing code and create your own button using an image here. For an image in your xcode project it might look something like: [theButton setImage:[UIImage imageNamed:@myIcon.png] forState:UIControlStateNormal]; with quotes around myIcon.png
 
QuiggityBiggity
Aspiring developer
Profile
Posts: 38
Reg: Aug 05, 2011
Baltimore
980
like
10/11/11 06:47 AM (14 years ago)
you're the best! Thank you for tracking down that file for me! I should be able to handle the rest..
 
QuiggityBiggity
Aspiring developer
Profile
Posts: 38
Reg: Aug 05, 2011
Baltimore
980
like
10/11/11 01:11 PM (14 years ago)
Okay maybe not: //ignore if button type is none if([tmpLoadScreenId isEqualToString:@showDirections]){ [theButton setImage:[UIImage imageNamed:airplane.png] forState:UIControlStateNormal]; }else{ if([tmpLoadScreenId length] > 1 || [tmpLoadScreenNickname length] > 1 || [tmpLocation.jsonVars objectForKey:@loadScreenObject]){ theButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; This line: [theButton setImage:[UIImage imageNamed:airplane.png] forState:UIControlStateNormal]; returns an error of 'passing argument 1 of 'imagednamed:' from incompatible pointer type (I'm using airplane.png as an example, but my custom icon will be placed in the same directory.) Thoughts? Thanks, Nick
 
Parker @ buzztouch
buzztouch Evangelist
Profile
Posts: 1395
Reg: May 09, 2011
Pacific Grove, ...
24,500
like
10/11/11 03:06 PM (14 years ago)
Looks like a syntax error. Hop on google and look up 'UIImage imageNamed' for reference, or look for it elsewhere in the project file. You look like you're missing the @ symbol, and possible the quotes around airplane.png
 
QuiggityBiggity
Aspiring developer
Profile
Posts: 38
Reg: Aug 05, 2011
Baltimore
980
like
10/13/11 06:50 AM (14 years ago)
fixed the syntax error, so now it builds with no errors, but instead of showing the airplane icon it just shows nothing. [theButton setImage:[UIImage imageNamed:@airplane.png] forState:UIControlStateNormal]; This may be a lost cause.
 
Parker @ buzztouch
buzztouch Evangelist
Profile
Posts: 1395
Reg: May 09, 2011
Pacific Grove, ...
24,500
like
10/16/11 04:52 PM (14 years ago)
Did you drag your airplane.png file into your BT_images folder in xcode? Did you recompile the app so the file would be included in the rebuild/reinstall? What does the console display when accessing this screen?
 
QuiggityBiggity
Aspiring developer
Profile
Posts: 38
Reg: Aug 05, 2011
Baltimore
980
like
10/16/11 07:06 PM (14 years ago)
I really wanted to get this app on the store, so I've submitted it without this change (it's waiting for review). I'll try to be thorough in what I did: The airplane.png icon (by buzztouch) already exists in the BT_images/icons directory. When I add the same icon to the BT_images directory, I get a 'multiple build commands for output file' warning when i build (the build does not fail though, it was just a warning). When I delete one png and leave the other, the icon still doesn't show up, albeit the warning is gone. Also, the code I copied above had quotes around the airplane.png but for some reason they didn't copy over. So currently when I change the code to include airplane.png, I don't get any errors, but I also get no button at all when I tap on a pin. When I built the app I cleaned out everything in the build folder, cleaned all targets and built using iOS 5.0. Console output: BT_viewControllerManager: the screen to load is nickname: Navigation Map itemId: 657FD99671D9CBC373BAAB6 itemType: BT_screen_map 2011-10-16 21:59:16.815 baltimorelr[15045:207] BT_viewControllerManager: initViewControllerForScreen nickname: Navigation Map itemId: 657FD99671D9CBC373BAAB6 type: BT_screen_map 2011-10-16 21:59:16.815 baltimorelr[15045:207] BT_screen_map: INIT 2011-10-16 21:59:16.816 baltimorelr[15045:207] BT_viewUtilities: setting nav-bar background for Navigation Map color: #000000 2011-10-16 21:59:16.816 baltimorelr[15045:207] BT_rotatingNavController: pushViewController for screen: 657FD99671D9CBC373BAAB6 2011-10-16 21:59:16.816 baltimorelr[15045:207] BT_screen_map: viewDidLoad 2011-10-16 21:59:16.817 baltimorelr[15045:207] BT_viewUtilities: getMapToolBarForScreen with nickname: Navigation Map and itemId: 657FD99671D9CBC373BAAB6 and type: BT_screen_map 2011-10-16 21:59:16.817 baltimorelr[15045:207] BT_viewUtilities: setting map tool-bar background color: #000000 2011-10-16 21:59:16.820 baltimorelr[15045:207] BT_screen_map: viewWillAppear 2011-10-16 21:59:16.820 baltimorelr[15045:207] BT_viewUtilities: configureBackgroundAndNavBar for screen with nickname: Navigation Map and itemId: 657FD99671D9CBC373BAAB6 and type: BT_screen_map 2011-10-16 21:59:16.821 baltimorelr[15045:207] BT_fileManager: File does exist in Xcode bundle: blank.png 2011-10-16 21:59:16.821 baltimorelr[15045:207] BT_background_view: Image for background view exists in Xcode bundle - not downloading. 2011-10-16 21:59:16.822 baltimorelr[15045:207] BT_background_view: setImage 2011-10-16 21:59:16.922 baltimorelr[15045:207] BT_screen_map: loadData 2011-10-16 21:59:16.923 baltimorelr[15045:207] BT_fileManager: File does exist in cached directory: screenData_657FD99671D9CBC373BAAB6.txt 2011-10-16 21:59:16.923 baltimorelr[15045:207] BT_screen_map: parsing cached version of screen data 2011-10-16 21:59:16.923 baltimorelr[15045:207] BT_fileManager: readTextFileFromCacheWithEncoding: screenData_657FD99671D9CBC373BAAB6.txt encoding: -1 2011-10-16 21:59:16.924 baltimorelr[15045:207] BT_screen_map: parseScreenData 2011-10-16 21:59:16.925 baltimorelr[15045:207] BT_screen_map: layoutScreen 2011-10-16 21:59:17.926 baltimorelr[15045:207] BT_screen_map: mapView:centerMap Do you think a reference to airplane.png is missing somewhere? The console doesn't refer to it at all
 
Parker @ buzztouch
buzztouch Evangelist
Profile
Posts: 1395
Reg: May 09, 2011
Pacific Grove, ...
24,500
like
10/18/11 11:22 AM (14 years ago)
Sorry, I should have asked you to tap on one of the pins. Specifically one of the pins using airplane.png.
 
QuiggityBiggity
Aspiring developer
Profile
Posts: 38
Reg: Aug 05, 2011
Baltimore
980
like
10/19/11 10:42 AM (14 years ago)
Nothing changes in the console when I tap a pin, and all of my pins should reference airplane.png.
 

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.