Chinaunix首页 | 论坛 | 博客
  • 博客访问: 431298
  • 博文数量: 83
  • 博客积分: 2622
  • 博客等级: 少校
  • 技术积分: 1345
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-17 08:59
个人简介

一直在努力

文章分类

全部博文(83)

文章存档

2014年(3)

2013年(9)

2012年(46)

2010年(25)

分类: LINUX

2012-03-06 13:46:18



点击TabBarItem 后,如果UINavigationController stack里面有多个viewcontroller
这个时候确省是popViewControllerAnimated 

客户项目需求点击后要求显示一些分类的button ,实现如下
重写 UITabBarController  delegate 下面的这个方法 

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

{

// NSLog(@"good to see it");

if (self.selectedViewController == viewController ) {

if ([((UINavigationController*)viewController).visibleViewController  respondsToSelector:@selector(showCategoryBtns)]) {

[ (TableViewController*)(((UINavigationController*)viewController).visibleViewController) showCategoryBtns];

}

}

return YES;

}

When you push or pop a view controller on/off a navigaction controller's stack, the usual viewWillAppear / viewDidAppear methods aren't called. If you want to ensure they're always called, just add the UINavigationControllerDelegate protocol to your root view controller:

@interface RootViewController : UIViewController { UINavigationController *navController; }

Then implement these two methods:

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated { [viewController viewWillAppear:animated]; } - (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated { [viewController viewDidAppear:animated]; }

Be sure to set the root view controller as the delegate for the nav controller. Now viewWillAppear / viewDidAppear will be called whenever a controller is pushed/popped from the stack.

If you want to call the viewWillDisappear/viewDidDisappear methods, your view controller still has to do that manually before popping itself off the nav stack.

@implementation UINavigationBar (CustomHeight)

- (void)layoutSubviews {
  [super layoutSubviews];
  CGRect barFrame = self.frame;
  barFrame.size.height = height;
  self.frame = barFrame;
}

@end

http://blog.sina.com.cn/s/blog_93f39bc20100wa8d.html


下拉刷新

支持上拉和下拉刷新http://hi.baidu.com/watsy/blog/item/16e04708829d6e880b7b82ff.html

阅读(1177) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~