A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© wwfkofufo 中级黑马   /  2014-8-27 13:50  /  832 人查看  /  1 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

1、判断一个view有没有superView

if ( [scrollView superviews] )
{
     [scrollView removeFromSuperView];
}
else
{
    [self.view addSubView:scrollView];

}

2、去除tableview的蓝色选中

吧tableview的Selection改为No Selection即可。

3、如何调用父view的controller里面的方法

[[self superview ].nextResponder  method];
[[[self superview ] nextResponder]  method];
[self.nextResponder method];
上面的都可以,看情况使用,使用的时候最好判断一下。

官方解释
UIView implements this method by returning the UIViewController object that manages it (if it has one) or its superview (if it doesn’t); UIViewController implements the method by returning its view’s superview; UIWindow returns the application object, and UIApplication returns nil.

4、如何隐藏tab bar controller 的tab bar

在Iphone编程中,很多人喜欢把Tab bar controller和Nav  一起混合使用,在点击了Tab bar上面的一个按钮切换到另一个view的时候,界面上的Tab Bar 没有消失.

导致view有部分的界面给遮挡了.所以需要把Tab Bar 给隐藏掉,隐藏代码如下:

self.newView = [[newViewController alloc] init];
newView.hidesBottomBarWhenPushed=YES;

1 个回复

倒序浏览
[self.navigationController presentModalViewController:newView animated:YES];

在建立新的View的时候加入

newView.hidesBottomBarWhenPushed=YES;

即可使Tab Bar消失掉.
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马