iOS杂谈

来源:互联网 发布:生化危机剧情 知乎 编辑:程序博客网 时间:2024/06/08 08:12

1)RGB转颜色

   #define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue &0xFF0000) >>16))/255.0 green:((float)((rgbValue &0xFF00) >>8))/255.0 blue:((float)(rgbValue &0xFF))/255.0 alpha:1.0

版本号

2)//发布版本号(Version)

   [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]

   //内部开发标识(Bulid)

   [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]

扩展:引导页-如初次安装app或版本升级则出现引导页

     保存应用版本,与当前版本比较不相等则出现引导页(同时保存当前版本),在引导页中止后,重新置引导页已显示标识

3)[superView addSubView:childView]

   当superView.frame = CGRectZero;childView!= CGRectZero 该死的childView一直显示着,误打误撞设置了下superView.clipsToBounds = YES;


//修改xib的约束view1.attr1 <relation> view2.attr2 * multiplier + constant   

 4)   [self addConstraint:[NSLayoutConstraintconstraintWithItem:self.imgVTitleattribute:NSLayoutAttributeWidthrelatedBy:NSLayoutRelationEqualtoItem:nilattribute:NSLayoutAttributeNotAnAttributemultiplier:1.0constant:self.imgVTitle.myWidth]];

//不清楚异步何时执行完,巧用Block,做后续操作(避免sleep)

       横竖屏

- (BOOL)shouldAutorotate NS_AVAILABLE_IOS(6_0);当前viewcontroller是否支持转屏


- (NSUInteger)supportedInterfaceOrientations;当前viewcontroller支持哪些转屏方向


-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation当前viewcontroller默认的屏幕方向



0 0
原创粉丝点击