Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/102.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 无法以编程方式设置UITabbarItem的操作_Objective C_Ios_Uitabbar_Uitabbaritem - Fatal编程技术网

Objective c 无法以编程方式设置UITabbarItem的操作

Objective c 无法以编程方式设置UITabbarItem的操作,objective-c,ios,uitabbar,uitabbaritem,Objective C,Ios,Uitabbar,Uitabbaritem,我需要为我的UITabbar设置操作,因为当我单击我的选项卡项时,它应该转到另一个viewcontroller中的操作 但它正在重定向到UITableview 这是我的密码- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIS

我需要为我的
UITabbar
设置操作,因为当我单击我的选项卡项时,它应该转到另一个viewcontroller中的操作

但它正在重定向到
UITableview

这是我的密码-

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

// create our table view controller that will display our store list    
FirstViewController *firstViewController = [[EzMasterViewController alloc] init];


// create the navigation controller that will hold our store list and detail view controllers and set the store list as the root view controller
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:firstViewController];
[navController.tabBarItem setTitle:@"Home"];
[navController.tabBarItem setImage:[UIImage imageNamed:@"53-house.png"]];


SecondViewController *secondViewController = [[SecondViewController alloc] init];


// create the navigation controller that will hold our store list and detail view controllers and set the store list as the root view controller
UINavigationController *navController1 = [[UINavigationController alloc] initWithRootViewController:secondViewController];
[navController1.tabBarItem setTitle:@"Scan"];
[navController1.tabBarItem setImage:[UIImage imageNamed:@"195-barcode.png"]];

ThirdViewController *thirdViewController = [[ThirdViewController alloc] init];


// create the navigation controller that will hold our store list and detail view controllers and set the store list as the root view controller
UINavigationController *navController2 = [[UINavigationController alloc] initWithRootViewController:thirdViewController];
[navController2.tabBarItem setTitle:@"Map"];
[navController2.tabBarItem setImage:[UIImage imageNamed:@"07-map-marker.png"]];

// add our view controllers to an array, which will retain them
NSArray *viewControllers = [NSArray arrayWithObjects:navController, navController1,navController2, nil];

// add our array of controllers to the tab bar controller
UITabBarController *tabBarController = [[UITabBarController alloc] init];
[tabBarController setViewControllers:viewControllers];

// set the tab bar controller as our root view controller    
[self.window setRootViewController:tabBarController];

// Override point for customization after application launch.
[self.window makeKeyAndVisible];
return YES;
}

通过单击
SecondViewController
tabbaritem,它应该重定向到操作,
其中动作在<代码> FrestVIEW控制器 .< /P> < P>您应该考虑实现以下两种方法:

– tabBarController:shouldSelectViewController:
– tabBarController:didSelectViewController:

嗨,你能给我一个完整的细节吗?在FirstViewController中,我有一个按钮操作,我想在appdelegate中调用它,