杂类未分类

来源:互联网 发布:配音软件手机软件 编辑:程序博客网 时间:2024/05/16 09:58

隐藏tabbar

隐藏UITabBarController的tabBar, 我用它的一个属性hidesBottomBarWhenPushed
隐藏了,可以pop的时候TabBar不显现了,我用另外改变tabBarController的view和TabBar的Frame实现了这个隐藏和显示的功能,可是,我感觉既然它给了这个属性让我们隐藏,肯定会有比较简单的方法让它显示,暂时没找到教好的方法,请教高手!!
解决办法:
把 self.hidesBottomBarWhenPushed = YES;中的
self改成你要push进入的那个viewcontroller
eg:viewcontroller.hidesBottomBarWhenPushed = YES;
这样就可以了。

隐藏视图

self.view.hidden = YES
//button的当前图片
button.currentImage;
标题
button.currentTitle;
背景图
button.currentBackgroundImage
设置子视图的停靠(自动修改大小)模式
subView.autoresizingMask = UIViewAutoresizingFlexibleHeight| UIViewAutoresizingFlexibleWidth;
//打印包路径
NSLog(@”%@”, [[NSBundle mainBundle] bundlePath]);
/*设置内容填充方式
imageView.contentMode = UIViewContentModeRedraw;
//结构体UIEdgeInset之间的比较

UIEdgeInsetsEqualToEdgeInsets(self.edgeInsets, edgeInsets);

//会让布局失效,进行重新布局

 [self invalidateLayout];

判断frame有无交集

CGRectIntersectsRect(attr.frame, rect)

单例对象

+ (instancetype)shareInstance{    static DataList *dataList = nil;    //多线程安全的单例    static dispatch_once_t onceToken;    dispatch_once(&onceToken, ^{        dataList = [[DataList alloc] init];    });    return dataList;}

扩展Category

注意:扩展Category里面不可以加成员变量,只能添加方法

扩展,不可以加成员变量,只能添加方法

kvc不对应崩溃

//为防止使用KVC赋值时由于key的原因导致的崩溃,重写以下2个方法- (void)setValue:(id)value forUndefinedKey:(NSString *)key{    //不能调用super    NSLog(@"捕获到未匹配到key --> %@",key );}- (id)valueForUndefinedKey:(NSString *)key{    return nil;}

隐藏状态栏

1. 如果只是想把当前页面的状态栏隐藏的话,直接用下面的代码就可以了    [[UIApplication sharedApplication] setStatusBarHidden:TRUE];2. 如果是想把整个应用程序的状态栏都隐藏掉,操作如下:    在info.plist上添加一项:Status bar is initially hidden,value为YES;    完后在MainAppDelegate.mm的- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions方法里面加上如下一句就可以了:    [[UIApplication sharedApplication]setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
0 0
原创粉丝点击