设置导航栏Edit 、自定义按钮 获取当前活动的Tab索引和UIViewController

来源:互联网 发布:手机迅雷连不上网络 编辑:程序博客网 时间:2024/06/07 13:52

设置导航栏Edit按钮

Self.navigationItem.leftBarButtonItem =[self  editButtonItem];

-(void)setEditing:(BOOL)editinganimated:(BOOL)animated

{

         [supersetEditing:editiong animated:animated];

         //设置tableView的Editing属性

         [_tableViewsetEditing:editing animated:animated];

}

设置导航栏自定义按钮

Self.navigationItem.leftBarButtonItem =[[[UIBarButtonItem alloc]

initWithTitle:@”Add”Style:UIBarButtonItemStyleBordered

target:self

action:@selector(addButtonPress)]autorelease];

 

捕获Tab切换事件,获取当前活动的Tab索引和UIViewController对象,代码如下。
-(void)tabBarController:(UITabBarController *)barControllerdidSelectView Controller:(UIViewController *)viewController

{
 NSLog(@"currentController index:%d",viewController,    tabBarController.selectedIndex);
 UIViewController *currentController = tabBarController.selectedView Controller;
   NSLog(@"currentController: %@",currentController

}

 

NSString :分类的方法:setValue:elementStringforkey:@”name”;

原创粉丝点击