Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 7    Views: 122

LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
08/31/15 03:40 PM (8 years ago)

pull to refresh in menu plugins

hey there, Kittsy has inserted the "pull to refresh" method in his side menu which works pretty much perfectly. It would look really good in menu plugins as well like the Menu Image Buttons for example. If you hide the top navigation bar and use the "pull to refresh" many apps would look way better without loosing the functionality of manually refreshing! Maybe one of the code gurus here could show how to put Kittsy´s code (sure he will not mind as he is gone) in the Menu Image Buttons for example? Part of his code in the AK_SlideMenu.m: UIRefreshControl *refresh = [[UIRefreshControl alloc] init]; refresh.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; refresh.attributedTitle = [[NSAttributedString alloc] initWithString:@"refreshing app"]; [self.sideTableView addSubview:refresh]; [self.view addSubview:sideTableView]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(eventHandler:) name:MFSideMenuStateNotificationEvent object:nil ];
 
Red Dog
buzztouch Evangelist
Profile
Posts: 805
Reg: Jun 16, 2011
Southern Califo...
18,800
like
09/01/15 12:45 PM (8 years ago)
Hi Leon. I can't speak to Susan's Menu Image Buttons plugin. I don't have that one. If it helps, here is the code for any tableView menu: //allows us to check to see if we pulled-down to refresh -(void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView{ [self checkIsLoading]; } -(void)checkIsLoading{ if(isLoading){ return; }else{ //how far down did we pull? double down = myTableView.contentOffset.y; if(down <= -65){ if([[BT_strings getJsonPropertyValue:self.screenData.jsonVars nameOfProperty:@"dataURL" defaultValue:@"1"] length] > 3){ [self downloadData]; } } } }
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
09/01/15 03:06 PM (8 years ago)
I know that part of code from the menu plugins as well yes, but that doesn't even work on the menu with image? Even if it would, the buttons menu is different :(
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
09/03/15 05:34 AM (8 years ago)
Hi Leon, I believe that the code @Red dog posted does work on the std buttons menu, but there is a peculiarity in that you need have enough buttons on screen to so that scrolling is already active. I believe if things are not scrolling, pull down doesn't work. Alan
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
09/03/15 08:08 AM (8 years ago)
that does not make too much sense to me then, but could be right. I will PM Susan and ask her if she has the possibility to add it to her plugin. Homescreens look so much nicer without nav bars!
 
Susan Metoxen
buzztouch Evangelist
Profile
Posts: 1706
Reg: May 01, 2011
Hopkins, Minnes...
26,260
like
09/03/15 08:55 AM (8 years ago)
Hi, everyone. I can take a look at it, but I am not sure when if it would work and when I would get it done. If so, it would only work for iOS. The Menu Image Buttons doesn't use a TableView, but it is just a variation on the standard Menu Buttons plugin so anything that works on that should be fairly easy to add to Menu Image Buttons.
 
Susan Metoxen
buzztouch Evangelist
Profile
Posts: 1706
Reg: May 01, 2011
Hopkins, Minnes...
26,260
like
09/03/15 08:57 AM (8 years ago)
One more thought on all of this. The pull down to refresh works when you have the menu items on a dataUrl. It wouldn't refresh the app, but would pull down the most current JSON on the dataUrl. Right?
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
09/03/15 09:02 AM (8 years ago)
Hey Susan, thx for the quick reply. Kittsy´s Slide Menu refreshes the app like the standard left navigation button does, so that works without using the data url!
 

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.