Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 14    Views: 37

Nelson
Aspiring developer
Profile
Posts: 57
Reg: Jun 06, 2013
Viseu
2,220
10/29/14 06:26 AM (9 years ago)

Smugs Location Menu to load another screen

is it possible to laod another screen or bye loadScreenWithNickname loadScreenItemId, after Sw_loc_detail. And I want the Sw_loc_detai appear, but do not load the BT_screen_map. I need it to open a diferent screen on each row. If I use loadScreenObject it goes ok, but I need to load a menu that already exists. This is the JSON that I am using {"childItems":[{"itemId":"1","itemType":"Sw_loc_detail","itemNicknam":"Junto a Se","iconName":"http://www.appens.org/control_panel/files/applications/EA98CF7FD484BCBDBA9979E3E/images/a_colmeia.png","titleText":"A Colmeia","descriptionText":"Rua das Ameias, 12-14","latitude":"40.659464","longitude":"-7.911208","categoryText":"Restaurante","subcategoryText":"Tipico","loadScreenItemId":"FCB314E21EE08B9FD791F88"},{"itemId":"","itemType":"Sw_loc_detail","itemNicknam":"Junto ao rossio","iconName":"","titleText":"O Aquario","descriptionText":"Largo da republica","latitude":"40.657227","longitude":"-7.914066","categoryText":"Restaurante","subcategoryText":"Snack Bar","loadScreenItemId":"65E8D207373D8406AECA5CC"}]}
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
10/30/14 05:06 AM (9 years ago)
The Smug Location menu can load screens in one of three ways; 1) Load Screen Object 2) Load Screen by ID 3) Load Screen by Nickname This is mitigated via the 'didSelectRowAtIndexPath' method around line 275-ish if you already know the itemId you can use loadScreenByItemId rather than loadScreenObject... Cheers! -- Smug
 
Nelson
Aspiring developer
Profile
Posts: 57
Reg: Jun 06, 2013
Viseu
2,220
like
10/30/14 10:19 AM (9 years ago)
hello Smug, I saw the code in line 260, we have "loadScreenWithItemId" "loadScreenWithNickname" and "loadScreenObject" but when I change the JSON for "loadScreenWithItemId" "loadScreenWithNickname" gives me this error. "there was a problem parsing some JSON data. Please make sure That It is welll-formed". This is my JSON do you see something wrong? This is a valid JSON. { "childItems": [ { "itemId": "1", "itemType": "Sw_loc_detail", "itemNicknam": "Junto a Se", "iconName": "http://www.appens.org/control_panel/files/applications/EA7BC3D02DB4A3A89C04F2696/images/colmeia.png", "titleText": "A Colmeia", "descriptionText": "Rua das Ameias, 12-14", "latitude": "40.659464", "longitude": "-7.911208", "categoryText": "Restaurante", "subcategoryText": "Tipico", "loadScreenWithItemId": "FCB314E21EE08B9FD791F88" } ] } will I have to change some code in SW_locationmenu.m? Nelson
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
10/30/14 04:41 PM (9 years ago)
You shouldn't have to change any code... Is this just a sample? I noticed itemNickname was mis-spelled. Could you send me your app json in a private message and let me take a look? Cheers! -- Smug
 
Nelson
Aspiring developer
Profile
Posts: 57
Reg: Jun 06, 2013
Viseu
2,220
like
10/30/14 05:25 PM (9 years ago)
Just send you a Direct Message. Nelson
 
Nelson
Aspiring developer
Profile
Posts: 57
Reg: Jun 06, 2013
Viseu
2,220
like
11/01/14 06:36 AM (9 years ago)
Hello Smug, did you received my email? sorry I messed up, only the latter is that it is correct Nelson
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
11/02/14 05:22 PM (9 years ago)
Sorry; had to go off the grid for a day or so. Let me test a couple of things later, and I'll get back with you. Cheers! -- Smug
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
11/02/14 08:52 PM (9 years ago)
Nelson, I figured out the issue. The issue was me, lol! Although I 'thought' I accomodated 'loadScreenWithItemId', I did not. I have released an update in the plugin market that fixes the issue; you may want to update your project with the new code. Apologies. Cheers! -- Smug
 
Nelson
Aspiring developer
Profile
Posts: 57
Reg: Jun 06, 2013
Viseu
2,220
like
11/03/14 04:44 AM (9 years ago)
Thak you Smug I'll try. It is a very powerful pluguin I am extremely delighted with it. I opened a new world of possibility for new app's. let me ask you another question, can the icon of the Smugs Location Menu came from a url, or is necessary to put the image in xcode.I can not open it from a url. Can I change the size of the icon? Nelson
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
11/03/14 07:16 AM (9 years ago)
Well, the icon 'size' is laid out in the SW_locationmenu_cell.xib file, and is not 'dynamically' adjustable. You 'could' change the size in the xib, but it would be a 'global' change, and all icons would need to adhere to the new size, at least in that project. At the moment, I don't think an icon can be called from a URL; the code doesn't support it. This is due to my mindset while designing the plugin; since it was originally designed to work with the 'Offline Map Kit' plugin, things were kind of made for offline use, so the icons are expected to be added to your bundle. I might work on updating it to accomodate URL based images, but it won't be this week. Thanks for your kind words, it was a labor of love. Cheers! -- Smug
 
Nelson
Aspiring developer
Profile
Posts: 57
Reg: Jun 06, 2013
Viseu
2,220
like
11/03/14 07:31 AM (9 years ago)
Thanks Smug, if you do the update icon for URL, put a post in the forum about it so I get to know. Thank you Nelson
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
11/03/14 09:54 AM (9 years ago)
I'd have to write in some code to allow the image to cache... for the moment, if you were to add this code in the 'cellForRowAtIndexPath' : NSRange hasIconURL = [[thisItem.jsonVars objectForKey:@"iconName"] rangeOfString:@"http"]; if (hasIconURL.location != NSNotFound) { [cell.sw_cellIconView setImage:[BT_imageTools getImageFromURL:[thisItem.jsonVars objectForKey:@"iconName"]]]; } else { [cell.sw_cellIconView setImage:[UIImage imageNamed:[thisItem.jsonVars objectForKey:@"iconName"]]]; } at the bottom, AFTER the code for sw_cellRoadSignView and BEFORE the "return cell" statement, it will test for a URL, and if valid will download the image and place it in the cell. otherwise, it will load from the bundle. However, I think you'll find it more advantageous to just put your icons in the bundle. Downloading each icon is painfully slow, and until caching is available, it will load each and every time the location menu is displayed. Response time is horrible, lol! But if you want to test it, that's a way to do so. Cheers! -- Smug
 
Nelson
Aspiring developer
Profile
Posts: 57
Reg: Jun 06, 2013
Viseu
2,220
like
11/03/14 10:52 AM (9 years ago)
Hello Smug, the code is giving an error that is " Use of undeclared identifier 'BT_imageTools'" Do you know what this is? Nelson
 
Nelson
Aspiring developer
Profile
Posts: 57
Reg: Jun 06, 2013
Viseu
2,220
like
11/03/14 11:01 AM (9 years ago)
Ok. This is fantastic. Just solved the problem I put #import "BT_imageTools.h" on top. It is working. Thank you Smug Nelson
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
11/03/14 04:25 PM (9 years ago)
oops. my bad. Sorry about that. I'm a half-thinker, not a whole thinker. ;) Cheers! -- Smug
 

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.