iOS - iOS开发碎碎念
来源:互联网 发布:卷积矩阵运算法则 编辑:程序博客网 时间:2024/06/05 18:26
模版化开发,使用不用的xib来显示对应的界面,来实现多个模版用一个软件可不可行?
UIImage图片缩放
- (UIImage *)scaleImage:(UIImage *)image toScale:(float)scaleSize{ UIGraphicsBeginImageContext(CGSizeMake(image.size.width * scaleSize, image.size.height * scaleSize)); [image drawInRect:CGRectMake(0, 0, image.size.width * scaleSize, image.size.height * scaleSize)]; UIImage *scaledImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return scaledImage;}
把一个View加到Window上显示为全屏
NSEnumerator *frontToBackWindows = [UIApplication.sharedApplication.windows reverseObjectEnumerator]; for (UIWindow *window in frontToBackWindows){ BOOL windowOnMainScreen = window.screen == UIScreen.mainScreen; BOOL windowIsVisible = !window.hidden && window.alpha > 0; BOOL windowLevelNormal = window.windowLevel == UIWindowLevelNormal; if (windowOnMainScreen && windowIsVisible && windowLevelNormal) { [window addSubview:self.overlayView]; break; } }
其中UIApplication.sharedApplication.windows 获取app中所有windows
reverseObjectEnumerator 为反向出入数组
BOOL windowOnMainScreen = window.screen == UIScreen.mainScreen;BOOL windowIsVisible = !window.hidden && window.alpha > 0;BOOL windowLevelNormal = window.windowLevel == UIWindowLevelNormal;
if (windowOnMainScreen && windowIsVisible && windowLevelNormal)
这段是为了找到最前面的window?
GitHub 简单使用
到https://github.com/ 建立一个库
并勾选 Initialize this repository with a README 选项
打开 SourceTree 添加远程仓库
选择从URL克隆
填入仓库地址并选择一个空文件夹
把文件复制到该空文件夹
于 SourceTree 中打开,先拉取 再提交推送
AudioUnit 频谱分析
UICollectionView 默认当cell数量少时不能滑动,
添加: collectionView.alwaysBounceVertical = YES;
即可。用于 CollectionView 下拉刷新
添加一个 SakuraScrollView 于页面中,当push进一个页面再返回,SakuraScrollView的bounds被修改成-64,原因未知。
http://unremittingly.iteye.com/blog/2031626
添加一个View在 SakuraScrollView 前
UIView *firstSubView = [[UIView alloc] initWithFrame:self.bounds]; [self addSubview:firstSubView];
问题解决。
遇到一个奇怪的问题,无论从 Finder 进入 Time Machine 的文件夹提示没有权限,点选菜单栏中的 进入 Time Machine 则显示暂时无法连接 Time Machine。后台发现它仍然在后台进行备份操作。我尝试使用终端进入 Time Machine 的文件夹成功,随意复制一个文件出来, Time Machine 恢复正常。(终端进入带有空格文件夹名称的需要使用’\’ $cd my\ files)
绘制渐变颜色线条关键词cgcontextdrawlineargradient
在注册Cell和补充视图时,也可以用新建xib文件的方式:
[self.myCollectionView registerNib:[UINib nibWithNibName:@"MyCollectionCell" bundle:nil] forCellWithReuseIdentifier:@"hxwCell"];[self.myCollectionView registerNib:[UINib nibWithNibName:@"MySupplementaryView" bundle:nil] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"hxwHeader"];[self.myCollectionView registerNib:[UINib nibWithNibName:@"MySupplementaryView" bundle:nil] forSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:@"hxwFooter"];
用这种方式注册后,甚至可以不用新建类去绑定这个xib,直接通过viewWithTag的方式获取xib里的控件:
UICollectionReusableView *view = [collectionView dequeueReusableSupplementaryViewOfKind :kind withReuseIdentifier:@"hxwHeader" forIndexPath:indexPath];UILabel *label = (UILabel *)[view viewWithTag:1];label.text = @"empty";
富文本
NSForegroundColorAttributeName字体颜色
NSKernAttributeName字间距
NSMutableAttributedString * myString = [[NSMutableAttributedString alloc]initWithString:dct[M_NavName]];[myString addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor] range:NSMakeRange(0, 1)];[myString addAttribute:NSKernAttributeName value:[NSNumber numberWithFloat:4] range:NSMakeRange(0, 1)];cell.titleLabel.attributedText = myString;
参考:富文本以及自定字间距和行间距
设置UIButton上字体的对齐方式,不是用:
[payWayButton.titleLabel setTextAlignment:UITextAlignmentCenter];
也不是 [payWayButton.titleLabel.titleLabel setTextAlignment:UITextAlignmentCenter];
而是用: [payWayButton setContentHorizontalAlignment:UIControlContentHorizontalAlignmentCenter];
titleLabel 是 Button 上的一个控件,设置 label 的对齐方式并不能让label 置于 button 的左边。
使用 git 的分支功能实现不同风格 View 集合。
Gradle 是以 Groovy 语言为基础,面向Java应用为主。基于DSL(领域特定语言)语法的自动化构建工具。
- iOS - iOS开发碎碎念
- iOS - iOS开发碎碎
- iOS - 为了自动打包研究nomad工具碎碎念
- 碎碎碎碎念
- 验证码开发的碎碎念
- 碎碎念
- 碎碎念
- 碎碎念。。。
- 碎碎念
- 碎碎念
- 碎碎念
- 碎碎念
- 碎碎念
- 碎碎念
- 碎碎念
- 碎碎念
- 碎碎念
- 碎碎念
- Node.js的Connect框架的代码重写与改进
- 004 Annoyance
- 人月经典语录
- java获取当前系统信息
- 解决wordpress发布文章,图片无法居中的问题
- iOS - iOS开发碎碎念
- 浙江大华2012笔试题+答案解析
- Docker的网络模式及Pipework工具介绍(转)
- Android(Lollipop/5.0) Material Design(二) 入门指南
- 华为2012.09.03浙大机试题
- ExtJs布局中,控件如何水平居中?
- 在arcgis javascript 中map地图的div 总是显示高度400的问题
- LAD(Log Archive Dest)配置不当引起备份失败
- 黑马程序员——Java基础---IO(一)---IO流概述、字符流、字节流、流操作规律