Discussion Forums  >  Uncategorized

Replies: 1    Views: 156

The Bone
Apple Fan
Profile
Posts: 1
Reg: Nov 10, 2011
Fayettevilliage
10
11/10/11 10:47 PM (14 years ago)

A Button that links to a Different Page depending on What Day It Is?

Hey, I'm wondering if anyone has tried to make a tab on the home page that would link to a different page depending on what day it is? i.e. If it is Friday and you want to go for a night on the town, it will display drink specials and events for only Friday night, based on a calendar of events. I've coded a little bit for engineering programs, but I'm new to this, any help would be much appreciated. -John
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
11/10/11 11:47 PM (14 years ago)
Neat idea. I can think of a few ways to do this, all take a bit of skill. And, because I see you're not on the early adopter list you'll need to get on it so you can use v1.5, it's much more flexible. The idea, create a v1.5 app so you can use tabs. iOS (assuming your working with iOS) requires a UIViewController to be loaded into each tab when the app creates it's interface. So, the view is already loaded when the app launches. Tapping the tab shows the view. This means the logic for your magic will need to exist in whatever view controller you choose for that tabs home-screen. This is where the fun begins. I would choose one of the built in screen types, say BT_screen_webView.m, .h for example...copy that class (both files). Rename this new class to something else. Like, myCustomView.m and myCustomView.h. You'll also need to rename it in the class file itself, a few places in the code refer to it's own name so you'll need to change those names. So, you have your custom class. Make a custom plugin screen in your list of screens (this will make more sense when you create a v1.5 app) so you can set it as a tabs home screen. So far so good. At this point you have your custom class loading for a tab's home screen. It's in the myCustomView.m file that you would figure out what day it is and do your magic. You could load a different URL on differnent days, randomize it, etc. The basic idea here is that you would use your own class file that acts like the one you copied so you could leverage that code then figure out in that code where it loads the URL and adjust accordingly. Good luck!
 

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.