在我的應用程序中,我有一個用於管理三個視圖控制器的uitabbar控制器。現在我想添加聲音,如果用戶點擊了任何一個標籤。源代碼:如何在用戶點擊UITabBarController標籤時播放聲音
// Declare all three view controllers
nextview *con = [[nextview alloc]init];
nextview1 *con1= [[nextview1 alloc] init];
nextview2 *con2 = [[nextview2 alloc] init];
//declare tab barcontroller
UITabBarController *tabBarController = [[UITabBarController alloc] init];
tabBarController.view.frame = CGRectMake(0, 0, 320, 480);
// Set each tab to show an appropriate view controller
[tabBarController setViewControllers:[NSArray arrayWithObjects:con,con1,con2, nil]];