一, iPhone手机升级最新系统后,Xcode在真机上编译运行时,可能会报错提示Could not find Developer Disk Image
原因是Xcode的DeviceSupport里面缺少了最新的iOS版本的SDK.
解决办法:
- 越新越好,更新Xcode到最新版本,但速度着实让人抓狂,没有耐性和时间可以放弃了。
- 缺啥补啥,直接把缺少的SDK导进去。
步骤如下:
- 打开Finder
- 找到应用程序文件夹
- 在里面找到XCode
- 点击XCode,右键,显示包内容
- Contents-->Developer-->Platforms-->iPhoneOS.platform-->DeviceSupport
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
- 然后你就能看到你的Xcode支持的真机测试的一些系统型号对应的文件
- 把你找到的最新的iOS版本的SDK拖进去
- http://pan.baidu.com/s/1qWIfrqc
二,UIbutton 按钮加图片后文字显示不出来解决方案
要在button上加图片,并且图片上显示button文字,应设置背景图片
[btn setBackgroundImage:[UIImage imageNamed:@"arrow.png"]forState:UIControlStateNormal];
三, 用xib或storyboard时,有时候会编译报警告Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0
This warning can also be triggered by labels that have numberOfLines
set to anything but 1 if your deployment target is set to 7.1. This is completely reproducible with new single-view project.
Steps to Reproduce:
- Create a new single-view, objective-c project
- Set the Deployment Target to 7.1
- Open the project's storyboard
- Drop a label onto the provided view controller
- Set the numberOfLines for that label to 2.
- Compile
四,改变scrollView方法setContentOffset的滚动速度
- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated;
animated设为YES时的滚动默认时间可能较长,要更改滚动速度可用[UIView animateWithDuration:2.0 animations:^{
scrollView.contentOffset = CGPointMake(x, y);
}];
同时setContentOffSet: animation: 有时候有卡顿,所以写此方法
-(void)setBgContentOffsetAnimation:(CGFloat )OffsetY
{ [UIView animateWithDuration:.25 animations:^
{
bgScrollView.contentOffset = CGPointMake(0, OffsetY);
}];
}
出现这种情况的原因有很多
1:runloop 中原因 系统为了资源禁用了动画 和其他事件的接收
2:短时间多次调用此方法 系统取消了动画
3:跟其他动画冲突
参看 http://codego.net/229277/五,Xcode7中定位EXC_BAD_ACCESS的debug功能
EXC_BAD_ACCESS一直是很多开发者的噩梦,因为这个错误很不直观,出现后往往要花很长时间才能定位到错误。苹果这次带来了革命性的提升。
在项目的Scheme中Diagnostics下,选中enable address sanitizer(注意选中后Xcode会重新编译整个项目)。

这样设置后,如果再出现类似的错误会有更详细的错误信息提示,甚至会有内存使用情况的展示。
参看:http://www.jianshu.com/p/70ed36cf8a98