ITeye博客

night sun

简单的茶 · 共 63 篇文章

Xcode 6 新建工程运行在 iOS 7 上下有黑边的问题

原因:Xcode 6 默认新建的启动页面为 LaunchScreen.xib,系统通过检测是否有这个文件,来判断 app 是否支持 iphone 6 & 6 plus. 如果要支持 iOS 7,还必须添加 Launch Image assets. 如果 app 要支持 iOS 7但是没有设置 Launch image assets ,在 iOS 7 上运行上下两边就会出现黑边。 解决办法: Target -> General Tab -> App Icons and Launch Images -> add launch image Apple 官网的说明地址:https://develop…

2014-11-02 10:01 · iOS · 评论(0)

怎么创建 UITableViewCell 的 xib

新建文件,选择 User Interface->View-> MyCell, 生成 MyCell.xib 打开 MyCell.xib ,删除自带的 View 拖拽一个 Cell 到 该 xib 通过以上步骤就生成了根 view 为 UITableViewCell 的 xib 文件

2014-10-27 13:08 · iOS · 评论(0)

iOS 调试问题小结

XCode 提示 ”set a breakpoint in malloc_error_break to debug “时,如何设置 malloc_error_debug? solution: Step 1: Set a breakpoint on malloc_error_break() by opening the Breakpoint Navigator (View->Navigators->Show Breakpoint Navigator or ⌘7), clicking the plus button in the lower left corner, and selecting …

2014-06-12 11:17 · iOS · 评论(0)

Java 实现字符串的回文判断

思路:用递归的方法;第一步为判断0和最后一个字符是否一样 实现: package palindrome; public class Palindrome { /** * @param args */ public static void main(String args) { // TODO Auto-generated method stub // String testStr = "abcdedcba"; String testStr = "abcdecba"; System.out.println(testStr + " is palinedrome ? " + isPalinedro…

2014-03-17 10:58 · 评论(0)

java 实现字符串逆置

题目: 写一个函数,将一个字符串变成倒序,结果存于原字符串,不得额外分配空间保存字符串。例如:abcdef 经变换后为 fedcba 算法思路: 采用递归算法,字符两两交换。 package reverseString; public class ReverseString { /** * @param args */ public static void main(String args) { String test = "12345"; System.out.println(reverse(test, 0, (test.length() - 1))); } private static …

2014-03-17 10:35 · 评论(0)

Could not launch " app name"

“could not launch app name”这个问题经常遇到,很讨厌。终于集齐了可以解决该问题的方法,要么一种方法即可以解决问题,要么这些方法得齐上阵。 1. 删除机器或模拟器上已经安装的该 app; 2. 删除 Derived Data: Shift+Command+2, 在 Projects 栏目下,右侧找到该工程,然后在左侧点击 Delete 按钮,删除该工程的 Derived Data. 3. 删除 Required device capability,在 -info.plist 文件中。 Good luck!

2013-12-19 11:11 · iOS · 评论(0)

Why iOS 5.x doesn't work under Maverick

The iOS simulator does not duplicate some of the low-level parts of iOS. For example, it uses the host OS X's kernel instead of trying to virtualize the iOS kernel. The iOS simulator requires that these subsystems look sufficiently similar between the simulated iOS and the host OS X. When a new hos…

2013-12-19 09:52 · iOS · 评论(0)

How to know whether a project uses ARC

There are 2 method to check whether a project is using ARC. Select the project, open Build Settings. Look for Objective-C Automatic Reference Counting in the Apple LLVM Compile - Language section. Try sth like this in code: init] ]autorelease]; If U get an error :ARC forbids explicit message send o…

2013-12-17 11:17 · iOS · 评论(0)

kAudioSessionIncompatibleCategory

A Note About kAudioSessionIncompatibleCategory Error on iOS 5 and 6 There is bug apparent on both iOS 5 and 6 (but not iOS 7) that manifests in apps that use the PlayAndRecord audio session category under certain multitasking conditions. The issue is triggered reliably via the following steps: Open…

2013-12-13 10:30 · iOS · 评论(0)

把 iOS app logs 写入 documents 文件夹

Now, in order to tell your app to redirect the NSLog() outputs to a file, you should do something like this: NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES); NSString *documentsDirectory = ; NSString *fileName =]; NSString *logFilePath = ; freopen(,"a…

2013-12-06 17:15 · iOS · 评论(0)

用 lipo 命令裁剪出需要的 architecture

iOS 上的 framework 和 .a 库一般会同时支持多个 architecture, 比如 i386, armv7, armv7s 等。 为了减小程序的尺寸,可能需要裁剪掉不需要的 architecture, 这时就需要使用 lipo 命令给程序瘦身。 Step1: 查看目标库文件支持的 architecture, 两个选择 1.1 lipo -info 目标库文件 1.2 file 目标库文件 Step2: 生成只支持一个 architecture 的 库文件 lipo 目标库文件 -thin 目标architecture 目标文件名 eg: lipo MVC -thin i386…

2013-11-06 15:23 · iOS · 评论(0)

写文件,真机和模拟器是不一样的

在真机上,只能往 Documents 和 tmp 目录下写文件。因为文件夹Resouces是只读的,无法写入。document 和temp文件夹的东西才是可读写的。 在模拟器上没有这个限制。 血泪教训啊!

2013-10-17 22:30 · iOS · 评论(0)

setValue:forUndefinedKey

使用 Storyboard 创建并管理 UI 时,在运行 app 的时候出现了 2013-10-15 09:21:03.212 TestMSR *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: ': this class is not key value coding-compliant for the key star.' 检查 storyboard 的 outlet 时也没发现自己连接过 star.....甚是奇怪。 在此处http://stackoverflow.com/ques…

2013-10-15 09:54 · iOS · 评论(0)

创建 Empty Application时, storyboard 不显示的问题

原因: 1. 创建 Empty Application 时没有 Using Storyboard 选项,需要手动创建 MainStoryboard。 2. Changed Main Storyboard in Target's Summary view 3. For an Empty Application, the default implementation of didFinishLaunchingWithOptions is : (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(…

2013-10-15 09:49 · iOS · 评论(0)

OC 和 C++ 混编

原文出处: http://blog.csdn.net/fengsh998/article/details/8010696 个人要点总结: 在 Xcode 中,Compile Sources As 的默认选项为 According to File Type。 不改变该设置的前提下,如果要在某个类中使用 C++ 代码,则必须把该类的后缀 由 .m 改为 .mm. 如果把 Compile Sources As 改为 Objective-C++,则无需把 类的后缀改为 .mm。

2013-10-08 15:45 · iOS · 评论(0)