0

I created a project with Tabbar template. The First View of my Tabbar project just wants the same function of the TTCatalog sample project. The Second View will integrate a Map function.

I integrate some code from TTCatalog sample project to do so. But when my App starts, only an empty tableview displayed in my first view. It's just a white table with some empty rows. nothing else.

When I quit my App from emulator, and start it again from emulator,first I can see a table view like that of TTCatalog ( with blue titles and labels), But soon the table view is covered with an empty table view.

Please help

thanks

user1188849
  • 107
  • 1
  • 12
  • Now I can get Either an empty tableview displayed in my first view, or a table view of TTCatalog ( with blue titles and labels) but not displayed in Tabbar view. How can I get a table view of TTCatalog ( with blue titles and labels) to be displayed in the First View of Tabbar. thanks – user1188849 Feb 04 '12 at 14:28
  • I add TTCatalog sample to my Tabbar project as the same method as Three20 to a project manually: http://three20.info/article/2010-10-06-Adding-Three20-To-Your-Project But I still can't invoke CatalogController ( instead of UITableViewController) as follows: @interface OneViewController : UITableViewController { } Shall I make TTCatalog sample into static libraries to achieve the above? How to make TTCatalog sample into static libraries ? thanks – user1188849 Feb 06 '12 at 11:38
  • What code of the TTCatalog did you integrate? TTCatalog is supposed to be an example of how to use Three20. It's not supposed to be copied verbatim. What is the effect you like to achieve? What data do you want to display? – tonklon Feb 07 '12 at 08:07
  • thanks tonklon so much for your reply! After my last question, I complied TTCatalog as a static library. then tried to invoke the TTCatalog library the same way as TTCatalog sample to invoke three20. – user1188849 Feb 07 '12 at 10:51
  • I just want FirstViewController ( of my TabBar ) to inherit CatalogController. But failed again. I like to achieve the effect of App Store on iPhone, that a tableview displayed above the Tabbar. – user1188849 Feb 07 '12 at 11:00

1 Answers1

1

There is no need to inherit CatalogController, if the only thing you need is a tableView inside a tabBarController then there is even no need to use three20 at all. To get started I would recommend you use a simpler approach. While three20 and the TTTableViewController can help a lot with a certain kind of setups, it is not the general best way to do things.

Let your FirstViewController inherit from UITableViewController, implement the UITableViewDataSource methods. If you are experiencing problem or need with a specific problem feel free to ask here.

If you got this working and you really need something that three20 can help you achieve, read through the TTTableViewController sources, TTModel, TTTableViewDataSource, find a tutorial and go on.

Maybe this question may help you: Three20's URL-based navigation + tab bar example? especially this link: http://three20.pypt.lt/url-based-navigation-and-state-persistence

Community
  • 1
  • 1
tonklon
  • 6,777
  • 2
  • 30
  • 36
  • Sorry,I did not illustrate my question clearly.Actually and more exactly, I do need TTTableViewController ( CatalogController ) inside a tabBarController. Just as the iPhone's build-in " Photo " App. When my App starts, first an Photo album ( Tableview ) appears, then when click a table row, thumbnail view appears with many small photos, when click one photo,the enlarged photo appears.Apple's sample code" myImage Picker" is much like my needs,but it's not inside a tab bar.And it can just pick image from photo album,but mine wants to pick image from bundle or internet.TTCatalog sample is needed – user1188849 Feb 08 '12 at 01:26
  • In short, I need to achieve the effect like "Zara" (ZARA shop online).thanks! – user1188849 Feb 08 '12 at 01:29
  • thanks tonklon so much! I had wanted to combine TTCatalog and TTNavigatorDemo together to achieve my goal. They should match well because they all have same architecture. But my App has Mapview in one of the tab bar. TTNavigatorDemo's MenuController all inherit from TTTableViewController. So I decide to integrate TTCatalog into an Apple Demo: TabSter. but the table view still covers the Tabbar. – user1188849 Feb 10 '12 at 11:21
  • If my answer was useful consider accepting it. Or upvote it. That's the way stack overflow works. – tonklon Feb 10 '12 at 11:46
  • At MenuController.h of TTNavigatorDemo, I intend MenuController to inherit from a Union, which includes TTTableViewController and TTViewController. so that one of my Tabs can also has a Mapview. I use the following code, but failed: union ControllerType { TTTableViewController *tvc; TTViewController *vc; } cp; @interface MenuController : cp {} . Please help,thanks – user1188849 Feb 11 '12 at 06:21
  • Sorry, that I really can't help here. I simply don't understand what you are trying to achieve, or where your problem is. But the first piece of code I saw: `union ControllerType { TTTableViewController *tvc; TTViewController *vc; } cp; @interface MenuController : cp {}` clearly tells me that you'll need a much deeper understanding of the Objective-C and C languages. This can never work that way. Please get an Obj-C book and start with something simpler. – tonklon Feb 11 '12 at 19:04
  • When integrate TTCatalog into an Apple Demo: TabSter. but the table view still covers the Tabbar. After I add :" [navigator setWindow:[[[UIWindow alloc] initWithFrame:TTScreenBounds()] autorelease]]; ", the five tab bar appears, but the window ( Three20 Catalog ) just freeze there, when I click the five tab bars, or "Photo Brower" or " Photo thumbnail" table row, it does not have any response. Does not switch to other tabs, or does not navigate to thumbnail views.The codes added to the "OneViewController" is as follows: – user1188849 Feb 12 '12 at 04:05
  • - (void)viewWillAppear:(BOOL)animated {[super viewWillAppear:animated]; NSIndexPath *tableSelection = [self.tableView indexPathForSelectedRow]; [self.tableView deselectRowAtIndexPath:tableSelection animated:NO]; self.navigationItem.backBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@"Catalog" style:UIBarButtonItemStyleBordered target:nil action:nil] autorelease]; self.title = @"Three20 Ca"; TTNavigator* navigator = [TTNavigator navigator];navigator.persistenceMode = TTNavigatorPersistenceModeAll; [navigator setWindow:[[[UIWindow alloc] initWithFrame:TTScreenBounds()] autorelease]]; – user1188849 Feb 12 '12 at 04:11
  • TTURLMap* map = navigator.URLMap; [map from:@"*" toViewController:[TTWebController class]]; [map from: @"tt://catalog"toSharedViewController: [OneViewController class]]; [map from: @"tt://photoTest parent: @"tt://catalog" toViewController: [PhotoTest1Controller class] selector: transition: 0]; if (![navigator restoreViewControllers]) { [navigator openURLAction:[TTURLAction actionWithURLPath:@"tt://catalog"]];} self.dataSource = [TTSectionedDataSource dataSourceWithObjects: @"Photos",[TTTableTextItem itemWithText:@"Photo Browser" URL:@"tt://photoTest1"], – user1188849 Feb 12 '12 at 04:26
  • [TTTableTextItem itemWithText:@"Photo Thumbnails" URL:@"tt://photoTest2"], nil]; } – user1188849 Feb 12 '12 at 04:27
  • sorry, correct 2 places error above: NSIndexPath *tableSelection = [self.tableView indexPathForSelectedRow]; – user1188849 Feb 12 '12 at 04:40
  • [PhotoTest1Controller class] selector:nil transition: 0]; if (![navigator – user1188849 Feb 12 '12 at 04:42
  • Eventually Table view and thumbnail view embedded into tab bar.( by combining TTCatalog sample and TTNavigatorDemo together.) but the thumbnail view lost its upper left "Catalog" button to return to its previous tableview. Following does not take effect in " Menu controller.m". – user1188849 Feb 12 '12 at 13:57
  • // NSObject - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { self.title = @"Three20 Catalog"; self.navigationItem.backBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@"Catalog" style:UIBarButtonItemStyleBordered target:nil action:nil] autorelease]; self.tableViewStyle = UITableViewStyleGrouped; } return self; } please help, thanks! – user1188849 Feb 12 '12 at 13:58
  • Sorry this is an unreadable mess. If you what to attach code, please edit your question. And make sure it's properly formatted. – tonklon Feb 12 '12 at 20:41
  • so sorry for the inconvinience caused to you. My requirements and goal are much similar with specified in the followinglink: http://www.techques.com/question/1-3284169/UITabBar-Disappears-When-Switching-to-Three20-TTThumbnail-View So I decide to test in my project to see if this method works for my bar hide function. then I may use this method to add my "Catalog" button to back to my TableWiew page.but when I change self.hidesBottomBarWhenPushed = YES to NO in "Three20UI"project that my project depends, it does not take effect.i.e.the thumbnail view still does not have the tab bar showed. – user1188849 Feb 13 '12 at 03:09
  • I tried to clean , clean all targets and build " Three 20 Ui" and my project again, but the method still does not work. So Surprised. thanks – user1188849 Feb 13 '12 at 03:11
  • finally a button appears when add the following code to (void)viewDidLoad {...} of the PhotoTest2Controller.m , but when click this upper-right button called " Catalog ", it first backs to an empty Form with an arrow button also at its upper-right button named " Three20 Catalog " .Click this arrow button again, it can back to the catalog page. – user1188849 Feb 13 '12 at 08:41
  • self.navigationItem.leftBarButtonItem= [[[UIBarButtonItem alloc] initWithTitle:@"Catalog" style:UIBarButtonItemStyleBordered target:self action:@selector(removeFromSupercontroller)] autorelease]; – user1188849 Feb 13 '12 at 08:42
  • All works except that the button is UIBarButtonItemStyle, instead of Navigator style button. thanks – user1188849 Feb 13 '12 at 14:13
  • sorry, Tonklon, just get to know how to up vote your reply. thanks – user1188849 Jun 05 '12 at 23:15