UA-17470720-3

Jump to content


Photo
- - - - -

Adding a Tabbed Application to my Existing Project


  • Please log in to reply
2 replies to this topic

#1 smith01804

smith01804

    Jr. Member

  • STV 4.0 Std
  • PipPip
  • 14 posts
Reputation: 0
Neutral

Posted 31 March 2014 - 07:30 AM

So every time I try to add a table I can't get the tabs to show up on the bottom of the screen. I can get my rootviewController to pop up and respond correctly but can't tab at the bottom. I also looked at the Core Data Sample Application that came with the software (which is a tabbed application) and still can't seem to get. In that example the app delegate is basically empty and i don't see where they make the connection to the root view controller. Heres my code in the delegate to generate the delegate.

 

    RootViewController *rootViewController = [[RootViewController alloc]

                                              initWithStyle:UITableViewStyleGrouped];

    UINavigationController *rootNavController =

    [[UINavigationController alloc]

     initWithRootViewController:rootViewController];

    

    if ([[UIDevice currentDevice] userInterfaceIdiom] ==

        UIUserInterfaceIdiomPhone

    {

        self.window.rootViewController = rootNavController;

    }

 

I also noticed that in my application when I clicked my one of my view controllers it has added a extra field called Text View - view, in which I cannot delete. But When I look at the Core Data Sample, its not even there! Can someone please help me! I must be doing something wrong... Obviously! 

 

Heres my a picture of my code and the example where I just explained.

 

 

 

 

Thank you!!

Attached Files



#2 Dave Guerin

Dave Guerin

    Forum Master

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 539 posts
  • LocationIreland
Reputation: 134
Popular

Posted 31 March 2014 - 01:19 PM

Hi smith01804,

 

The Core Data App example is doing it all with Storyboards, and you are doing it programatically.

 

If you want to do a tab bar app programatically you need something like this in the AppDelegate:

    MyViewController1 *myViewController1 = [[MyViewController1 alloc] initWithStyle:UITableViewStyleGrouped];
    UINavigationController *myNavigationController1 = [[UINavigationController alloc] initWithRootViewController:myViewController1];

    MyViewController2 *myViewController2 = [[MyViewController2 alloc] initWithStyle:UITableViewStyleGrouped];
    UINavigationController *myNavigationController2 = [[UINavigationController alloc] initWithRootViewController:myViewController2];

    UITabBarController *tabBarController = [[UITabBarController alloc] init];
    tabBarController.viewControllers = @[myNavigationController1, myNavigationController2];

    self.window.rootViewController = tabBarController;

There may be typos in there, but hopefully that'll point you in the right direction.

 

If you want to do it via Storyboards then set the Main Interface to your Storyboard. You do that in the General > Deployment Info for the Target.

 

 

Re the "Text View - view" it'll be in your code somewhere :-) Probably in a STV propertyNamesString:


  • Tarek, ozie and wizgod like this
Cheers,

Dave

www.dgapps.ie

#3 smith01804

smith01804

    Jr. Member

  • STV 4.0 Std
  • PipPip
  • 14 posts
Reputation: 0
Neutral

Posted 01 April 2014 - 05:37 PM

Thank you so much. I just had to add the storyboard as my target. As for the "TextView - view", its not gone since I did that. Thanks






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users