OC 开发当中的一些小技巧(持续更新ing)
来源:互联网 发布:老k平面户型优化设计 编辑:程序博客网 时间:2024/05/16 15:29
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
- (void)getNetworkingStatus{//私有方法
NSArray *subViews = [[[[UIApplication sharedApplication] valueForKey:@"statusBar"] valueForKey:@"foregroundView"] subviews];//获取前台页面的状态栏,注意如果隐藏了状态,此处无法取值。
//快枚举遍历状态栏视图集合,查找到需要的网络类型视图并存储
[subViewsenumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx,BOOL *_Nonnull stop) {
if([obj isKindOfClass:[NSClassFromString(@"UIStatusBarDataNetworkItemView") class]]){
dataView = obj;
}
}];
switch ([[dataView valueForKey:@"dataNetworkType"] integerValue]) {
case 0:NSLog(@"no wifi");break;
case1:NSLog(@"2G");break;
case2:NSLog(@"3G");break;
default:NSLog(@"wifi");break;
break;
}
}
//导航栏全透明设置ß
- (void)setNavigationBarType{
self.tabBarController.tabBar.hidden = YES;
self.navigationController.navigationBar.translucent = YES;
UIColor *col = [UIColor clearColor];
CGRect rec = CGRectMake(0, 0, CGRectGetWidth(self.view.bounds), 64);
UIGraphicsBeginImageContext(rec.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, col.CGColor);
CGContextFillRect(context, rec);
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[self.navigationController.navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];
self.navigationController.navigationBar.clipsToBounds = YES;
}
//导航栏全透明设置ß
- (void)setNavigationBarType{
self.tabBarController.tabBar.hidden = YES;
self.navigationController.navigationBar.translucent = YES;
UIColor *col = [UIColor clearColor];
CGRect rec = CGRectMake(0, 0, CGRectGetWidth(self.view.bounds), 64);
UIGraphicsBeginImageContext(rec.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, col.CGColor);
CGContextFillRect(context, rec);
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[self.navigationController.navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];
self.navigationController.navigationBar.clipsToBounds = YES;
}
- OC 开发当中的一些小技巧(持续更新ing)
- 一句话的小技巧(持续更新ing~)
- 安卓开发一些界面控件的小例子(部分内容转载,持续更新ING)
- Matlab 应用小技巧,持续更新ING
- IOS 小技巧 (持续更新ing.....)
- Cocos2d-JS开发中的一些小技巧(持续更新)
- java的Html和Css小技巧(持续更新ing)
- 关于实际开发中优化web的一些小技巧汇总(持续更新中)
- Android中一些开发的小技巧总结(持续更新)
- Python 里面的一些小技巧(持续更新)
- 一些有趣的网站(持续更新ing)
- ORACLE 常用技巧(持续更新ing)
- [持续更新]android stduio的一些小技巧
- Html记录一些有用的小技巧持续更新.....
- 一些小技巧,持续更新[C#]
- 记录开发当中遇到的问题及小知识点(持续更新...)
- Android Studio 常用技巧(持续更新ing)
- iOS开发中总结的小技巧(持续更新中)
- javascript改变input radio的样式
- uva122--二叉树的层次遍历
- 《百鸟朝凤》,以匠心会知音
- GitLab的简单使用
- 【腾讯Bugly干货】Android性能优化典范之多线程篇
- OC 开发当中的一些小技巧(持续更新ing)
- [二进制构造 || DP] BZOJ 3107 [cqoi2013]二进制a+b
- 用jQuery写扩展插件实现语音播报
- 常用正则表达式大全,手机、电话、邮箱、身份证(最严格的验证)、IP地址、网址、日期等,一般前台js验证
- 算法导论之堆排序相关
- 根文件系统移植之使用busybox
- Activity的生命周期
- 有return的情况下try catch finally的执行顺序(最有说服力的总结)
- pythoneer 的三大神器—pip入门基础教程