Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 21    Views: 335

Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
01/16/13 01:17 PM (13 years ago)

Shake that app, shake that app for a method, for a method

Apologies for the song. Be mindful of magic 8 ball copyright lol Add this to the plugin you want, outside any other methods curly braces this copy has a shake to access to access screen by nickname - (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event { if ( event.subtype == UIEventSubtypeMotionShake ) { //appDelegate yourApp_appDelegate *appDelegate = (yourApp_appDelegate *)[[UIApplication sharedApplication] delegate]; NSString *loadScreenNickname = @"yourScreenNicname"; //load new screen BT_item *mynextScreen = [appDelegate.rootApp getScreenDataByNickname:loadScreenNickname]; BT_item *screenObjectToLoad = nil; if([loadScreenNickname length] > 1){ screenObjectToLoad = [appDelegate.rootApp getScreenDataByNickname:loadScreenNickname]; ////leave alone [BT_viewControllerManager handleTapToLoadScreen:[self screenData]:nil:mynextScreen]; } } if ( [super respondsToSelector:@selector(motionEnded:withEvent:)] ) [super motionEnded:motion withEvent:event]; } - (BOOL)canBecomeFirstResponder { return YES; } if you want the clear code without the new screen method - (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event { if ( event.subtype == UIEventSubtypeMotionShake ) { // Put your method here } if ( [super respondsToSelector:@selector(motionEnded:withEvent:)] ) [super motionEnded:motion withEvent:event]; } - (BOOL)canBecomeFirstResponder { return YES; }
 
Mr stuck
Android Fan
Profile
Posts: 974
Reg: Apr 09, 2012
Fife, Scotland
15,740
like
01/16/13 01:24 PM (13 years ago)
You keep amazing us @Kittsy. With you on buzztouch I really need to buy a Mac to make IOS apps. I feel like I am missing out.
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
01/16/13 01:35 PM (13 years ago)
If eclipse was a man I'd hit him, If Xcode was a man I'd tickle his ____.
 
Mr stuck
Android Fan
Profile
Posts: 974
Reg: Apr 09, 2012
Fife, Scotland
15,740
like
01/16/13 01:44 PM (13 years ago)
I can't wait to get my hands on a Mac. I always said I would get one after xmas and carry on getting used to using buzztouch till then by developing android apps. But now I feel like I am ready to get stuck into IOS. With all the new plugins appearing for IOS i think its about time I started saving some serious cash to finally get that Mac!
 
MacApple
Apple Fan
Profile
Posts: 4675
Reg: Oct 25, 2010
USA
61,150
like
01/16/13 02:05 PM (13 years ago)
Have a shake feature in latest app, really adds something. Shaking to visit a random attraction. Interacting with hardware is of course key to keep the Apple folk happy. Doing it a little bit different from above but same results.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
01/16/13 02:19 PM (13 years ago)
If all I ever do is code for Windows Platforms, I'd still rather do it from my Macintosh. God I hate the company. God I love their stuff. Cheers! -- Smug
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
01/16/13 02:21 PM (13 years ago)
@macapple is your code more efficient
 
MacApple
Apple Fan
Profile
Posts: 4675
Reg: Oct 25, 2010
USA
61,150
like
01/16/13 02:28 PM (13 years ago)
I think so, doing it quite different, running through it at moment.... Went down a completely different road. App will be live at end of this month but working well at the moment. Loaded with flu at moment, staring at screen hurts.
 
Mr stuck
Android Fan
Profile
Posts: 974
Reg: Apr 09, 2012
Fife, Scotland
15,740
like
01/16/13 02:36 PM (13 years ago)
Flu. Man that's the worst ever. Staring at anything hurts. Hope you get over it soon buddy!
 
hacerapps
buzztouch Evangelist
Profile
Posts: 542
Reg: Jan 30, 2011
usa
11,170
like
01/16/13 03:03 PM (13 years ago)
Shake Shake Shake , Shake that app lol one of the songs of blow movie Your are a bt Rockstar Kittsy Thanks again buddy
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
01/16/13 03:14 PM (13 years ago)
Where abouts do I need to the code? Do I add this code to all pages I want to randomly call up? Just not sure how use. Kittsy, do you want to be my new buddy, liking your style.
 
PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
like
01/16/13 03:22 PM (13 years ago)
Great Share Kittsy!! Thanks for this. Best Regards, Danny
 
mutzy
Aspiring developer
Profile
Posts: 841
Reg: Nov 03, 2010
Medford, MA
9,860
like
01/16/13 03:53 PM (13 years ago)
Dave gave me a tutorial about a year ago on how to "shake" to get back to the home screen. If anyone's interested here's the discussion post: http://www.buzztouch.com/forum/thread.php?tid=C075D70763120E5C03C765F&command=isSearching&currentPage=1&topicTitle=shake&createdBy=&repliedBy=&minViews=-1&maxViews=-1&minReplies=-1&maxReplies=-1&forumCategory=
 
feraco
Aspiring developer
Profile
Posts: 705
Reg: Jan 23, 2012
nyc
15,050
like
01/16/13 06:15 PM (13 years ago)
Hey i integrated this code into a plugin and when I shake the device it just goes directly to a blank screen with the background. Could you guys clarify. In the code above am I only adding my screen nickname to the part of the code that says "yourScreenNicname"; NSString *loadScreenNickname = @"yourScreenNicname"; or do I add my screen nickname to other parts as well. I am really excited to get this to work. Can someone helpout?
 
feraco
Aspiring developer
Profile
Posts: 705
Reg: Jan 23, 2012
nyc
15,050
like
01/16/13 06:23 PM (13 years ago)
Ok I got it! lol I was putting my screen nickname instead of my item nickname. When I changed it to my item nickname it worked. Kittsy thank you for all the info today! I feel like Im learning so fast from these forum posts. in one week I plugged in parse, socialize and now shake!
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
01/17/13 06:45 AM (13 years ago)
good work again from the community! i'd love to see @MacApple's version as i want to be able to do something similar to what he has suggested. on my app I have 20 screens that are selectable from a menulist. i'd love for them to be able to shake the device and open one of these 'pages' at random
 
MacApple
Apple Fan
Profile
Posts: 4675
Reg: Oct 25, 2010
USA
61,150
like
01/17/13 06:53 AM (13 years ago)
@bonzo Will let you have it as soon as it's released.
 
LevensGardener
Aspiring developer
Profile
Posts: 220
Reg: Sep 30, 2012
Kendal
10,450
like
03/11/13 08:45 AM (12 years ago)
Well, I got the app MacApple- Louisvilleliving. It is great- many feature I really like. Can you share your shake code? Thanks Chris
 
feraco
Aspiring developer
Profile
Posts: 705
Reg: Jan 23, 2012
nyc
15,050
like
06/27/13 06:55 AM (12 years ago)
Hello Everyone I had this working a few months back now my apps crashing when i shake. I add the code above and when I shake to the next screen the app crashes and says this in xcode 2013-06-27 09:48:42.716 innovationfitness[91045:c07] BT_application: screenType is BT_screen_htmlDoc for screen with nickname: Calendar 2013-06-27 09:48:42.716 innovationfitness[91045:c07] +[BT_viewControllerManager handleTapToLoadScreen:::]: unrecognized selector sent to class 0x2fccb4 2013-06-27 09:48:42.762 innovationfitness[91045:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[BT_viewControllerManager handleTapToLoadScreen:::]: unrecognized selector sent to class 0x2fccb4' *** First throw call stack: In xcode this line of kittsys code is highlighted yellow [BT_viewControllerManager handleTapToLoadScreen:[self screenData]:nil:mynextScreen]; Im not sure how to fix this. Any suggestions?
 
StaleysGirl
Aspiring developer
Profile
Posts: 56
Reg: Jul 02, 2012
San Diego
4,260
like
09/09/13 06:04 PM (12 years ago)
I'm starting app #3 and was hoping I could find a whiz with a shaker plugin. Thanks for that! Amazing work!! I have lots of catching up to do :)
 
0z2000tv
Aspiring developer
Profile
Posts: 315
Reg: Sep 10, 2011
Nashville
11,950
like
09/10/13 07:01 AM (12 years ago)
StaleysGirl In the last couple of weeks I contacted several of the developers in this thread. They were unsuccessful in adding a random shake feature. Let me know if you are more successful. Good luck with app #3. Mike
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
12/02/13 01:36 PM (12 years ago)
 

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.