Discussion Forums  >  Uncategorized

Replies: 9    Views: 252

DavidTheGreat
Aspiring developer
Profile
Posts: 13
Reg: Dec 27, 2011
Central Ohio
130
02/07/12 12:29 PM (12 years ago)

Is a Swipe Gesture Possible?? Feature Request

My iOS app (already live) has many points where I think a Swipe gesture would add to the app. I would like to have users swipe left or right to go to the next or previous BT screen in the app. I'm relatively comfortable with Xcode and I'm fine with interface builder but I'm not really sure where to start with this... I figure some of us could benefit from this feature so if anyone knows how this can be done, I really appreciate the help :) Thanks, David
 
Aescleah
Code is Art
Profile
Posts: 43
Reg: Sep 15, 2011
Earth
430
like
02/07/12 12:37 PM (12 years ago)
Abolutely everything is possible! :-) Basically, you need to add a gesture recognizer to your view controller. Of course, Apple's documentation is the best place to start, and gesture recognizers are not too complicated to implement. Take a look here: https://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/GestureRecognizers/GestureRecognizers.html And if you take a look at the sample code given in the doc, you'll find exactly what you're asking for: https://developer.apple.com/library/ios/#samplecode/SimpleGestureRecognizers/Introduction/Intro.html#//apple_ref/doc/uid/DTS40009460-Intro-DontLinkElementID_2 Have fun :-)
 
DavidTheGreat
Aspiring developer
Profile
Posts: 13
Reg: Dec 27, 2011
Central Ohio
130
like
02/07/12 12:59 PM (12 years ago)
I think I understand the process but I'm not sure the standard way of doing it will work... I haven't used BT Server but in BT 1.5 Screens don't each have their own view controller so I'm not sure how to point the swipe to the right page... In BT 1.5 all the screens share common .h and .m files for view controllers so there isn't a defined place for me to segue to... Any thoughts on how I can get the gesture to go to a specific page in 1.5 I don't know where I should point it to since there aren't individual files for each separate screen.
 
Aescleah
Code is Art
Profile
Posts: 43
Reg: Sep 15, 2011
Earth
430
like
02/07/12 01:08 PM (12 years ago)
Indeed you're right, the way everything is handled can make things a bit more complicated. However, you can easily find a workaround. Let's say that the screen to which you want to add the gesture recognizer is a webview. Just duplicate the files BT_screen_webview.h and BT_screen_webview.m and rename them the way you want. For this example, let's call custom_controller.h and custom_controller.m. In both files, you'll want to replace every instance of BT_screen_webview by custom_controller. Once this is done, you can add your gesture recognizer wherever you need it (probably in the viewDidLoad method). Now, how to make this work with buzztouch? Here comes the magic of plugins :-) In your control panel, create a new screen as a custom plugin. You will name the class custom_controller in the corresponding json in the configuration file. Finally, just replace the screens in the appropriate way in the control panelso that instead of launching the old BT_screen_webview you will launch you custom_constroller, and that's it! I have done this countless times, and ended up with my app being made almost only of custom plugins! You can take a look here if you want (the app is free - it's in french but the english version is coming in an update in the next few days): http://itunes.apple.com/fr/app/atra-materia-mobile/id495471019?mt=8 I hope all this makes sense!
 
mysps
Code is Art
Profile
Posts: 2082
Reg: May 14, 2011
Palma
33,320
like
02/07/12 01:41 PM (12 years ago)
Awesome post and I love your app custom plugins @ Aescieah.. I'll use this as motivation at getting In-App to work :) Merci!
 
MGoBlue
Apple Fan
Profile
Posts: 980
Reg: Jun 07, 2011
Gold River, CA
10,600
like
02/07/12 04:39 PM (12 years ago)
Hey @Aescleah - really impressed with the app. Love the sharing feature on the posts. Really cool. It looks like your rss feed is being embedded in the app so news can be read offline. Is this the case? Would you mind sharing how you accomplished that? Been working on a way to do it myself. Thanks and great job.
 
Aescleah
Code is Art
Profile
Posts: 43
Reg: Sep 15, 2011
Earth
430
like
02/08/12 05:25 AM (12 years ago)
@mysps Thanks again for your kind comments! The update with the english version has been waiting for review for a few days now, so it should appear on the store soon :) I'm sure you'll get in-app purchases to work very soon! You can take a look at Apple's doc too, they even give all the sample code you need! @MGoBlue Thank you! :) Regarding my rss feed and the offline use, you're absolutely right. There are several ways to accomplish that. The first one would be to parse the html of the web page you want to display, save it on the disk, and then load this html string in the webview: this has the advantage of being super fast and clean, but unfortunately requires quite a lot of coding and a lot of tweaks to get it to work with a buzztouch app. For your content to be accessible offline, what you need is to have the content you want to display available on the disk, so you will need to cache the data. And there is a simple and fast way to do that! If you look at how BT_screen_webview works, you will see that it uses an NSURLRequest. In older versions of iOS, Apple allowed to cache the content of these requests on the disk, but it is no longer possible with the latest versions of iOS. Not possible, but it is not forbidden either, and there is a wonderful tool to do exactly what we need and which is quite simple to implement: SDURLCache. The source code is available here: https://github.com/steipete/SDURLCache SDURLCache allows you to cache the content of NSRULRequests both in memory and/or on the disk. Once you're set (the readme file explains everything), you will be able to cache everything on the disk! Then, if a user doesn't have any connection, when the request is fired, it will look for the data in the cache, and display it if it's there. That will require a little coding, of course, but it shouldn't be too complicated!
 
MGoBlue
Apple Fan
Profile
Posts: 980
Reg: Jun 07, 2011
Gold River, CA
10,600
like
02/08/12 06:52 AM (12 years ago)
Excellent. Thanks. I'll check that out. I'll look forward to seeing your English version as well.
 
OrchardApps
Code is Art
Profile
Posts: 115
Reg: Jan 11, 2012
Brisbane austra...
5,850
like
08/29/12 03:04 AM (11 years ago)
I wrote an slight expansion on this in the hope that it helps other people that aren't as techie - like me. http://www.buzztouch.com/forum/thread.php?tid=F53086F5F9369431CF88A8B&fid=BC70C36A743CD4FAD95D17F&sortColumn=FT.id&sortUpDown=DESC&currentPage=1
 
Fred@mySkylla com
Android Fan
Profile
Posts: 5259
Reg: Oct 03, 2011
location unknow...
62,560
like
09/02/12 04:16 PM (11 years ago)
The Custom Plugin he refers to is the BTv1.5 use Custom Plug-In screen. In BTv2.0 you can use either the Blank Screen Plugin or My Cool Plugin that'll be available in the Buzztouch Market very soon. Awaiting approval. For self hosted contact me directly. Fred
 

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.