iphone uitabbar菜单选项而不是视图

时间:2011-10-18 09:41:27

标签: iphone uitabbar

我有一个带有6个标签的标签栏控制器。第6个标签我想简单地做一个动作(比如评价这个应用程序)而不是移动到新视图。

标签栏元素需要有一个视图对象,所以有什么办法可以解决这个问题,直接调用一个执行动作的选择器。

编辑: 这是我想从第6个标签调用的选择器,并继续保留在当前视图中。

-(void)action_rateThisApp:(id)sender {

NSString *str = @"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa";
str = [NSString stringWithFormat:@"%@/wa/viewContentsUserReviews?", str]; 
str = [NSString stringWithFormat:@"%@type=Purple+Software&id=", str];

// Here is the app id from itunesconnect
// http://itunes.apple.com/us/app/cricbuzz-cricket-scores-news/id360466413?mt=8
str = [NSString stringWithFormat:@"%@360466413", str];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
}

1 个答案:

答案 0 :(得分:0)

您可以实现委托功能

- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController

拦截标签栏项目触摸。从那里你可以做任何你想做的事。您可以生成所需的界面视图,以便为应用程序评级并将其添加到主窗口(以便它叠加在当前视图上,无论您当前在哪个选项卡上)。