我有以下問題: 有包括以下列方式五個選項卡類:UITabBarContrtoller從不同的類實現iPhone
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];
}
在contactTab類中有一個UITableViewController。
contactTab.h
- (void)updateCellData;
- (void)configureCell:(UITableViewCell *)cell forIndexPath:(NSIndexPath *)indexPath;
還有第三個類,這是我想實現是的UITableViewController的(來自ContactTab)的方法。
到目前爲止,我嘗試這樣做: 當我試圖實現的UITabBarController:
MainMenuClient *menu;
UITabBarController *tabBarControllerchange = [[UITabBarController alloc] init];
tabBarControllerchange = menu.tabBarController;
[tabBarControllerchange setSelectedIndex:0];
當我試圖達到的UITableViewController:
ContactListTab *contactListTab;
[contactListTab updateCellData];
是否有人對這個問題的想法?謝謝。鮑拉日。
我不明白嗎?你有什麼問題? – vodkhang 2010-06-16 10:26:23