Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 15    Views: 96

Becky
I hate code!
Profile
Posts: 269
Reg: Aug 08, 2012
NYC
6,140
12/09/13 02:48 PM (11 years ago)

Design Menu - Images not loading on simulator

Using 3.0 - Button images are not loading on simulator. I see little dials as if they are trying to load but they just keep going round. I'm wondering if I will need to wait for an update with the Plugin or if there's a quick fix for this...
 
SheriDee
Code is Art
Profile
Posts: 1094
Reg: Sep 23, 2011
location unknow...
22,840
like
12/09/13 04:04 PM (11 years ago)
It appears the icons are not recognizing xcode project images but they are if you host them....weird. Writing Danny https://www.buzztouch.com/psmdanny (plugin owner) to see if he has some insight.
 
Becky
I hate code!
Profile
Posts: 269
Reg: Aug 08, 2012
NYC
6,140
like
12/09/13 04:37 PM (11 years ago)
Thanks Sheri :)
 
PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
like
12/10/13 11:18 AM (11 years ago)
Hi All, Thanks for this thread. I wasn't aware this wasn't working as supposed. ok here's the solution for now (I'll update the plugin as soon as I can...) In BTA_cell_designMenu.m (line 416) you see the method showImage. Select from the beginning until the last parenthesis (before 'downloadImage') and replace it with this code: - (void)showImage { @synchronized(self) { if ([[NSThread currentThread] isCancelled]) return; [thread cancel]; // Cell! Stop what you were doing! thread = nil; if ([theMenuItemData imageName]) { // If the image has already been downloaded. //set the image UIImage *tmpImage = [UIImage imageNamed:theMenuItemData.imageName]; [cellImageView setImage:tmpImage]; [imageLoadingView performSelectorOnMainThread:@selector(stopAnimating) withObject:nil waitUntilDone:NO]; } if ([theMenuItemData imageURL]) { // We need to download the image, get it in a seperate thread! thread = [[NSThread alloc] initWithTarget:self selector:@selector(downloadImage) object:nil]; [thread start]; } } } This should work for you until I have the plugins updated! Best Regards, Danny
 
SheriDee
Code is Art
Profile
Posts: 1094
Reg: Sep 23, 2011
location unknow...
22,840
like
12/10/13 02:56 PM (11 years ago)
Works Danny!
 
PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
like
12/10/13 02:58 PM (11 years ago)
Hi Sheri, Great!!!! Best Regards, Danny
 
Becky
I hate code!
Profile
Posts: 269
Reg: Aug 08, 2012
NYC
6,140
like
12/10/13 03:01 PM (11 years ago)
Works for me too:) Thank you!
 
PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
like
12/10/13 03:02 PM (11 years ago)
Hi Rtommervik, Good! You're welcome! Best Regards, Danny
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
12/10/13 09:27 PM (11 years ago)
Hi Danny, Thank you! Appreciated it. I am going to use your code changes to fix the Menu with Image too, same issue. Cheers friend. David https://buzztouchmods.com/hire-me
 
PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
like
12/11/13 12:50 AM (11 years ago)
OK Mr. David, Let me know if that works! Best Regards, Danny
 
mysps
Code is Art
Profile
Posts: 2082
Reg: May 14, 2011
Palma
33,320
like
12/13/13 05:03 AM (11 years ago)
Yep, it works for BlogPro as well, it had the problem too. thanks!
 
Susan Metoxen
buzztouch Evangelist
Profile
Posts: 1706
Reg: May 01, 2011
Hopkins, Minnes...
26,260
like
12/13/13 07:45 AM (11 years ago)
I have updated the Menu with Image, but the other issue we have right now is that if a plugin developer uploads a plugin, the new iOS source files aren't replaced with the package. This is our most urgent issue right now and David is working on it.
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
12/24/13 12:34 PM (11 years ago)
No luck at all. Danny, do you see anything off here? - (void)showImage { //imageURL... NSString *imgURL = [BT_strings getJsonPropertyValue:theMenuItemData.jsonVars nameOfProperty:@"iconURL" defaultValue:@""]; if([imgURL length] > 3){ //create an NSURL from the url string... NSURL *useURL = [NSURL URLWithString:imgURL]; //download image using Grand Central Dispath, iOS handles queue automagically... dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul); dispatch_async(queue, ^{ if ([theMenuItemData image]) { // If the image has already been downloaded. //set the image [self performSelectorOnMainThread:@selector(setImageFromThread:) withObject:theMenuItemData.image waitUntilDone:NO]; //hide loading spinner... [imageLoadingView performSelectorOnMainThread:@selector(stopAnimating) withObject:nil waitUntilDone:NO]; } else { // We need to download the image, get it in a seperate thread! NSData *data = [NSData dataWithContentsOfURL:useURL]; UIImage *image = [UIImage imageWithData:data]; [self performSelectorOnMainThread:@selector(setImageFromThread:) withObject:image waitUntilDone:NO]; } dispatch_async(dispatch_get_main_queue(), ^{ [imageLoadingView performSelectorOnMainThread:@selector(stopAnimating) withObject:nil waitUntilDone:NO]; }); }); } }
 
PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
like
12/24/13 01:34 PM (11 years ago)
Hi David, Not sure in what plugin you use this but if it's my plugin just use the exact code I gave. Others confirmed that it works! I'm not at my computer now because of christmas so I can't test anything at the moment. Hope this helps. Best regards and a merry Christmas for every one. Danny
 
Becky
I hate code!
Profile
Posts: 269
Reg: Aug 08, 2012
NYC
6,140
like
12/24/13 10:05 PM (11 years ago)
David - I see a few things off with what you're using. I used Danny's exact code and it worked for me a few times over. The first thing I noticed is your ending is off… - (void)showImage { @synchronized(self) { if ([[NSThread currentThread] isCancelled]) return; [thread cancel]; // Cell! Stop what you were doing! thread = nil; if ([theMenuItemData imageName]) { // If the image has already been downloaded. //set the image UIImage *tmpImage = [UIImage imageNamed:theMenuItemData.imageName]; [cellImageView setImage:tmpImage]; [imageLoadingView performSelectorOnMainThread:@selector(stopAnimating) withObject:nil waitUntilDone:NO]; } if ([theMenuItemData imageURL]) { // We need to download the image, get it in a seperate thread! thread = [[NSThread alloc] initWithTarget:self selector:@selector(downloadImage) object:nil]; [thread start]; } } }
 
Becky
I hate code!
Profile
Posts: 269
Reg: Aug 08, 2012
NYC
6,140
like
12/24/13 10:06 PM (11 years ago)
btw - what I posted was Danny's code that he gave to us before...
 

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.