Discussion Forums  >  Uncategorized

Replies: 2    Views: 176

jsa986
Apple Fan
Profile
Posts: 24
Reg: Jan 19, 2012
location unknow...
240
02/09/12 02:25 PM (12 years ago)

viewDidload screen

Hi all I want to make a custom alert when a user first uses my app, im following a youtube tutorial and the alert code goes after the viewDidload section. Where is the equivalent code in the view controller.m delegate in buzztouch package? is it here somewhere? initWithViewController ------------------------- This method returns the appropriate screen view controller for the passed in screen object. All BT_screen controllers have an initWithBTscreen method that is used to initialize the controller. It's possible that the app is asked to init a screen that doesn't exist in it's configuration data. */ +(id)initViewControllerForScreen:(BT_item *)theScreen{ if([theScreen itemId] == nil){ [BT_debugger showIt:self:[NSString stringWithFormat:@initViewControllerForScreen: ERROR finding screen with itemId: %@, [theScreen itemId]]]; }else{ if([theScreen.itemNickname length] > 1){ [BT_debugger showIt:self:[NSString stringWithFormat:@initViewControllerForScreen nickname: \%@\ itemId: %@ type: %@, [theScreen itemNickname], [theScreen itemId], [theScreen itemType]]]; }else{ [BT_debugger showIt:self:[NSString stringWithFormat:@initViewControllerForScreen nickname: \%@\ itemId: %@ type: %@, @no nickname?, [theScreen itemId], [theScreen itemType]]]; } } Instantiate a view controller with ClassName == BT_item.itemType. If the itemType is a custom plug-in we need to get the type of view controller to allocate from the JSON data... */ //return this view controller. NSObject *theViewController = nil; NSString *theClassName = [theScreen itemType]; //are we loading a custom plugin? if([[theScreen itemType] isEqualToString:@BT_screen_plugIn]){ //get the class name of the custom UIViewController we want to load... theClassName = [BT_strings getJsonPropertyValue:theScreen.jsonVars:@classFileName:@]; } //screenType required if([theClassName length] > 0){ Class theClass = NSClassFromString(theClassName); if(theClass != nil){ if([theClass respondsToSelector:@selector(alloc)]){ theViewController = [[theClass performSelector:@selector(alloc)] initWithScreenData:theScreen]; return theViewController; } } }//screenType length if(theViewController == nil){ [BT_debugger showIt:self:[NSString stringWithFormat:@initViewControllerForScreen: ERROR, could not initialize view controller for screen with itemId: %@, [theScreen itemId]]]; //get error screen data BT_item *errorScreenData = [self getErrorViewController]; theViewController = [[BT_screen_menuList alloc] initWithScreenData:errorScreenData]; } //should not be here. return theViewController; Thanks in advance
 
MacApple
Apple Fan
Profile
Posts: 4674
Reg: Oct 25, 2010
USA
61,140
like
02/09/12 06:41 PM (12 years ago)
OK. Stab in the dark here. If you are looking to create an alert you could go for a rate this app alert workaround. Have a look at this post - http://www.buzztouch.com/forum/thread.php?tid=E134991A0FC2671F49979F9&status=&searchInput=rate&sortColumn=FT.dateStampUTC&sortUpDown=DESC¤tPage=1&doViews=1 Many have this working and you could customise to your own needs.
 
Aescleah
Code is Art
Profile
Posts: 43
Reg: Sep 15, 2011
Earth
430
like
02/10/12 01:24 AM (12 years ago)
I'm not sure I followed everything, where is the code you're giving coming from? The BT_viewcontroller.m file (mine looks completely different)? Anyway, to me, it just seems you're not looking in the right place. If you want to display this alert when the user starts your app, you have to identify which screen is your home screen. Let's say that your app opens up on an RSS reader, then you'll have to put your alert in the viewDidLoad method of the BT_screen_rssReader.m file (this is just an example, could be anything). However, doing this might be a problem in case you have several rss reader screens in your app: the alert will then be triggered each and every time you display one of them, and this is not what you want. A solution would then be to create a dedicated custom plugin for this screen.
 

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.