iOS中的一些小知识点
来源:互联网 发布:大众软件 pdf 编辑:程序博客网 时间:2024/05/22 17:27
1.去掉导航栏下面的横线
4.简单的状态栏 导航栏
self.navigationController.navigationBar.shadowImage = [[UIImage alloc] init];
2.使UITableView上的cell点击后颜色消失
[tableView deselectRowAtIndexPath:indexPath animated:YES];
3.UIlabel自适应高度
CGSize descriptionSize = [descriptionLabel sizeThatFits:CGSizeMake(WIDTH-60, 1000000)];descriptionLabel.frame = CGRectMake(30,60, (WIDTH - 60), descriptionSize.height);
4.简单的状态栏 导航栏
隐藏状态栏
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO];
隐藏导航栏
[self.navigationController setNavigationBarHidden:YES];
5.RGB颜色转换
WTColorFromRGB(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]6.普通颜色值
WTColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]7.圆角设置
view.layer.cornerRadius = 6;view.layer.masksToBounds = YES;8.键盘关闭方法之一
- (void)setUpForDismissKeyboard { NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; UITapGestureRecognizer *singleTapGR = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAnywhereToDismissKeyboard:)]; NSOperationQueue *mainQuene =[NSOperationQueue mainQueue]; [nc addObserverForName:UIKeyboardWillShowNotification object:nil queue:mainQuene usingBlock:^(NSNotification *note){ [self.view addGestureRecognizer:singleTapGR]; }]; [nc addObserverForName:UIKeyboardWillHideNotification object:nil queue:mainQuene usingBlock:^(NSNotification *note){ [self.view removeGestureRecognizer:singleTapGR]; }];}- (void)tapAnywhereToDismissKeyboard:(UIGestureRecognizer *)gestureRecognizer { //此method会将self.view里所有的subview的first responder都resign掉 [self.view endEditing:YES];}9.导航栏自带的又拉手势
self.navigationController.interactivePopGestureRecognizer.enabled = YES;self.navigationController.interactivePopGestureRecognizer.delegate = nil;10.注册用户app发送推送弹出框
[[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];11.获取app版本号,名字
NSDictionary* infoDict =[[NSBundle mainBundle] infoDictionary]; NSString* versionNum =[infoDict objectForKey:@"CFBundleVersion"];//版本名称 NSString*appName =[infoDict objectForKey:@"CFBundleDisplayName"];//app名称12.使在运行程序的时候屏幕永远亮着
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];13.获取手机硬件信息
[[UIDevice currentDevice] systemName];[[UIDevice currentDevice] systemVersion];//os version[[UIDevice currentDevice] uniqueIdentifier];[[UIDevice currentDevice] model];[[UIDevice currentDevice] name];
一个很好的网址https://github.com/huang303513/iOS-Study-Demo
0 0
- iOS中的一些小知识点
- iOS一些小知识点
- IOS 中的一些知识点
- IOS学习中的一些小知识点总结(持续更新)
- iOS巅峰之项目中的一些小知识点整理
- IOS 一些小知识点整理
- 编程中的一些小知识点
- java中的一些小知识点
- Android中的一些小知识点
- Java中的一些小细节,小知识点
- 黑马程序员_Winform中的一些小知识点
- VC++连MySQL中的一些小知识点
- Spring MVC中的一些小的知识点
- html使用中的一些小知识点
- iOS 开发中的几个小知识点
- ios开发过程中的小知识点
- ios中的一些小技巧
- iOS 开发学习中的一些知识点汇总
- 思维导图之----javascript中function类型知识树
- 2.10-关系运算
- UVA - 11212 Editing a Book
- 单调队列
- 猫猫学iOS 之微博项目实战(4)微博自定义tabBar中间的添加按钮
- iOS中的一些小知识点
- UI____UIEvent以及响应者链
- 美国“懒人经济”风生水起
- NSOperation - 02
- Android 控件开发之Button
- 2.11-逻辑运算
- hadoop深入研究:(二)——java访问hdfs
- NYOJ —水池数目
- HDOJ 1232 畅通工程 (并查集)