UITabBarContrtoller achieve from a different class in iPhone

Posted by baluedo on Stack Overflow See other posts from Stack Overflow or by baluedo
Published on 2010-06-16T10:23:55Z Indexed on 2010/06/16 11:32 UTC
Read the original article Hit count: 315

Filed under:

Hi!

I have the following problem: There is a class that includes five tabs in the following way:

mainMenuClient.h

#import <UIKit/UIKit.h>

@interface MainMenuClient : UIViewController {
UITabBarController *tabBarController;
}
@property (nonatomic, retain) UITabBarController *tabBarController;

@end

mainMenuClient.m

-(void)viewDidLoad {

UIView *contentView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
contentView.backgroundColor = [UIColor blackColor];
self.view = contentView;
[contentView release];

ContactListTab *contactTab = [[ContactListTab alloc] init];
ChatTab *chat = [[ChatTab alloc]init];
DialerTab *dialer = [[DialerTab alloc]init];
MenuTab *menu = [[MenuTab alloc]init];
TesztingFile *teszting = [[TesztingFile alloc]init];
contactTab.title = @"Contact List";
chat.title = @"Chat";
dialer.title = @"Dialer";
menu.title = @"Menu";
teszting.title = @"TesztTab";

contactTab.tabBarItem.image = [UIImage imageNamed:@"Contacts_icon.png"];
chat.tabBarItem.image = [UIImage imageNamed:@"Chat_icon.png"];
dialer.tabBarItem.image = [UIImage imageNamed:@"Dialer_icon.png"];
menu.tabBarItem.image = [UIImage imageNamed:@"Menu_icon.png"];
teszting.tabBarItem.image = [UIImage imageNamed:@"Contacts_icon.png"];
chat.tabBarItem.badgeValue = @"99";

tabBarController = [[UITabBarController alloc]init];
tabBarController.view.frame = CGRectMake(0, 0, 320, 460);

[tabBarController setViewControllers:[NSArray arrayWithObjects:contactTab, chat, dialer, menu, teszting, nil]];

[contactTab release];
[chat release];
[dialer release];
[menu release];
[teszting release];

[self.view addSubview:tabBarController.view];

[super viewDidLoad];
}

In the contactTab class there are a UITableViewController.

contactTab.h

- (void)updateCellData;
- (void)configureCell:(UITableViewCell *)cell forIndexPath:(NSIndexPath *)indexPath;

There is a third class, which I would like to achieve is a method of UITableViewController's (from ContactTab).

So far I tried this: When I tried to achieve the UItabbarController:

MainMenuClient *menu;
UITabBarController *tabBarControllerchange = [[UITabBarController alloc] init];
tabBarControllerchange = menu.tabBarController;
[tabBarControllerchange setSelectedIndex:0];

When I tried to achieve the UITableViewController:

ContactListTab *contactListTab;
[contactListTab updateCellData];

Does anybody have an idea for this problem? Thanks. Balazs.

© Stack Overflow or respective owner

Related posts about iphone