您的位置:首页 > 移动开发 > IOS开发

IOS tabbar 点击刷新页面

2015-07-06 17:24 429 查看
参考网上资料

.h文件

[code]#import <UIKit/UIKit.h>

@interface TabbarRootViewController : UITabBarController<UITabBarControllerDelegate>

@end


.m文件

[code]#import "TabbarRootViewController.h"
#import "NoticeTableViewController.h"

@implementation TabbarRootViewController

-(void)viewDidLoad{
    [super viewDidLoad];
    self.delegate=self;
}
-(void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController{
    if (viewController.tabBarItem.tag==2) {
        UINavigationController *navigation =(UINavigationController *)viewController;
        NoticeTableViewController *notice=(NoticeTableViewController *)navigation.topViewController;
        [notice refreshData];
    }
}
//禁止tab多次点击
-(BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController{
    UIViewController *tbselect=tabBarController.selectedViewController;
    if([tbselect isEqual:viewController]){
        return NO;
    }
    return YES;
}

@end


在NoticeTableViewController 中写好刷新方法。即可点击tab刷新页面
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: