![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
osx开发
文章平均质量分 52
tjsjping
这个作者很懒,什么都没留下…
展开
-
NSLog中格式符列表
//NSLog的格式如下,当然[NSString stringWithFormat:]的格式也是一样的。//%@ 对象%d, %i 整数%u 无符整形%f 浮点/双字%x, %X 二进制整数%o 八进制整数%zu原创 2011-10-13 13:39:19 · 726 阅读 · 0 评论 -
Text, Web, and Editing Programming Guide for iOS读书笔记
Text field/Text view的管理1. 当拥护单击一个Text field的时候,这个Text Field就自动成为first responders2. 发送给Text field delegate的常用消息:textFieldShouldBeginEditing: 成为first responder之前(获取焦点之前)textFieldDidBeginEdit原创 2011-10-31 14:36:11 · 1270 阅读 · 0 评论 -
xcode 4.2 不支持gcc 4.2的解决方案
今天刚刚从xcode 3 升级到xcode 4.2, 发现gcc 4.2没有了,研究了以下发现是由于xcode 4.2不支持gcc4.2了,需要用llvmgcc4.2。由于项目中有几十个工程文件,如果每个工程都需要修改的话,工作量很大,而且也很无聊。想了一下,可以用xcconfig文件来解决这个问题:1. 随便找一个工程,把compiler修改成llvmgcc4.2, 然后拷贝这个选项到x原创 2011-10-21 14:33:24 · 2261 阅读 · 0 评论 -
区分是iphone还是ipad
@property (nonatomic, readonly) UIUserInterfaceIdiom userInterfaceIdiomUIDevice中的userInterfaceIdiom可以用来区分iphone还是ipad原创 2011-11-01 13:07:56 · 1057 阅读 · 0 评论 -
使用AVPlayer获取HTTP live stream audio文件的duration
关于AVPlayer的详细解析,请看Apple document。但是document里面并没有详细解析如何获取HTTP live stream文件的duration,google了一下,发现通过duration属性获取的方法,不能得到正确的直。正确的做法应该是通过调用AVPlayerItem的seekableTimeRanges来获取(loadedTimeRagnes表示已经下载的部分)。事原创 2011-11-21 14:27:58 · 5995 阅读 · 0 评论 -
UIViewController XIB/NIB加载过程
UIViewController中关于nib初始化的函数- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil;从这个函数的说明我们可以知道,如果你subclass一个UIViewController,不管有没有使用NIB, [super initWithNibName:bun原创 2011-11-01 16:41:01 · 11658 阅读 · 0 评论 -
iphone/ipad关于size, frame and bounds总结和UIScroll view学习笔记
1. iphone/ipad大小DeviceScreen dimensions(in points)iphone and ipod320 X 480ipad768 X 10242. UIScreen bounds and applicationFrame[UISCreen mainScreen].bounds, 永远返原创 2011-11-01 10:19:46 · 2849 阅读 · 0 评论 -
View Programming Guide for iOS读书笔记
View and Window Architecture一个view的所有subviews被安装顺序放在 一个数组中,放在数组最后的view会被显示出来;改变superview的行为,会对subview产生影响,例如修改大小,透明度等如果一个单击行为,当前的view没有处理,就会传给superview进行处理,当然一些特殊的view也会把消息传给responder object进行原创 2011-11-01 14:16:40 · 1944 阅读 · 0 评论 -
Message Forwarding总结
在Objective-C中,如果你将一个没有实现的消息发送给一个接受者,系统会调用接受者forwardInvocation:方法,从而给这个接受者一个二次处理的机会。机遇这个特性,我们可以做一些自己的处理。例如下面的调用,我们调用了一个不存在的方法,系统就会调用myObject对象的forwardInvocation:方法。objc_msgSend(self, @selector(di原创 2011-11-23 15:45:54 · 1019 阅读 · 0 评论 -
iOS平台下实现不同APP之间的通信
我们可以通过UIApplication的openURL方法来实现不同app之间的通信,如下面代码所示:NSURL *myURL = [NSURL URLWithString:@"todolist://www.acme.com?Quarterly%20Report#200806231300"];[[UIApplication sharedApplication] openURL:myURL];原创 2011-11-02 15:59:07 · 2937 阅读 · 0 评论 -
class-dump,分析可执行/app文件的函数定义
class-dump是一个开源项目,可以从http://www.codethecode.com/projects/class-dump/下载。下面是我对自己写的一个demo程序,GKDemo.app用class-dump解析后得到的结果:note: /Users/tonys/Library/Developer/Xcode/DerivedData/GKDemo-bgpwxsribkdlyph原创 2011-11-24 12:23:48 · 2737 阅读 · 0 评论 -
How To Choose The Best XML Parser for Your iPhone Project
come from below blog:http://www.raywenderlich.com/553/how-to-chose-the-best-xml-parser-for-your-iphone-project转载 2011-11-25 14:14:34 · 597 阅读 · 0 评论 -
ios多线程之我见
引言随着多核CPU的兴起,传统的线程处理方法已经不能满足现在的需求, 为了解决这个问题,apple ios提出了新的解决方法:GCD grand central dispatch,serial dispatch queue按序执行,concurrent queue并发执行operation queues, 遵循first in, first out原则opera原创 2011-11-07 09:12:27 · 4084 阅读 · 0 评论 -
编译ios平台的openssl
发现一个不错的地方介绍如何在ios平台下编译openssl,试用了一下,成功了。需要注意的一点是,需要用openssl1.0编译,同时编译出来的文件生成在openssl目录下面:libCrypto.a libssl.ahttps://github.com/sjlombardo/openssl-xcodeUsageIn a normal case原创 2011-11-28 11:53:52 · 4598 阅读 · 0 评论 -
osx获取全局键盘/鼠标事件
下面的代码可以获取osx下的键盘输入,这个是全局的,也就是说在其他Application中输入键盘事件,这些事件也能被捕获。CGEventRef myCallBack(CGEventTapProxy proxy, CGEventType type, CGEventRef event, void *userInfo){ UniCharCount actualStringLen原创 2011-11-30 14:57:27 · 6434 阅读 · 3 评论 -
xcode 4.2 设置.xcconfig文件
习惯于xcode 3的开发人员,升级到xcode 4.2以后,肯定会有一段时间不会适应,例如在什么地方可以设计xcconfig文件等。google了一下,终于发现如何在xcode 4.2设置这个文件了,直接上图:下图中红色部分,你就可以选择你想要的xcconfig文件了。原创 2011-11-11 13:55:59 · 4709 阅读 · 0 评论 -
使用TARGET_IPHONE_SIMULATOR和TARGET_OS_IPHONE宏区分模拟器和设备
代码如下: #if TARGET_IPHONE_SIMULATOR NSLog(@"run on simulator");#else NSLog(@"run on device");#endif注意不要用#ifdef TARGET_IPHONE_SIMULATOR, 因为在device上, TARGET_IPHONE_SIMULATOR被定义为0。、原创 2011-10-31 10:46:54 · 15667 阅读 · 0 评论 -
xcode 4.2 "XCode could not find a valid private-key/certificate pair for this profile" 解决方案
今天想在xcode上编译一个device上的app,发现xcode提示上面这个错误,google了一下,找到下面这个link:http://stackoverflow.com/questions/5391786/xcode-iphone-profile-doesnt-match-any-valid-certificate-private-key-pair-i根据这个帖子的提示信原创 2011-10-31 10:52:10 · 3723 阅读 · 0 评论 -
iphone开发 给应用程序设置美观的图标
网上看到的介绍转一下: 1 将需要的图片(最好为png格式)拷贝到Resources里。2选择Resources里的“项目名-info.plist文件”,在其中的Icon file一栏改为刚才图片的文件名。3重新编译运行程序,即可看到新设置的图标(图片会自动变转载 2011-10-13 13:47:44 · 609 阅读 · 0 评论 -
UILable实现按照文字多少定义大小
下面文章转载自http://wangjun.easymorse.com/?m=201106UILable显示文字,大多数情况下文字是动态的,所以UILable的大小需要自适用,下面是实现的具体代码:myLable=[[UILabel alloc] initWithFr转载 2011-10-18 15:58:27 · 764 阅读 · 0 评论 -
ios控制台利用gdb命令查看报错堆栈
下文来自http://wangjun.easymorse.com/?m=201103&paged=2在ios开发中,如果提前释放一个指针的内存,在以后还继续使用这个指针,那么程序会立刻crash掉,而且很难有报错信息,我以前都是靠猜测去判断错误的原因,我们应该利用工具去找到错转载 2011-10-18 16:15:12 · 969 阅读 · 0 评论 -
Building the Build System – Part 1 – Abandoning the Build Panel
below article comes from here XCode has a decent build system, but it doesn’t work as well as it could out of the box. With just a littl转载 2011-10-18 16:41:58 · 648 阅读 · 0 评论 -
Building the Build System – Part 2 – Project Templates
In Part 1 of our series, you learned how to use basic xcconfig files to manage build configuration in Xcode rather than using the Build Pane转载 2011-10-18 16:42:57 · 580 阅读 · 0 评论 -
mac lion 10.7.2 不支持SSL连接?
一个application本来在10.6版本上运行的很好,当系统升级到10.7.2的时候,发现连不上服务器了。具体原因现在还不知道,TBD原创 2011-10-25 10:02:37 · 747 阅读 · 0 评论 -
UIView中的frame和bounds属性的区别
Frame是基于父View的,bounds是基于自身的,所以两者的区别是frame的坐标和bounds的坐标会有区别,如下图:原创 2011-10-26 14:24:57 · 2408 阅读 · 0 评论 -
MainWindow.xib absence in Xcode 4.2 beta 4 with iOS 5 SDK
(FYI, this instruction is only for me. It is better to go to original article and follow.)1. Create new project in Xcode 4.2 beta and choose “Empty Application” template2. Add “New File” to th转载 2011-10-25 17:17:42 · 906 阅读 · 0 评论 -
在mac下显示隐藏文件
defaults write com.apple.finder AppleShowAllFiles -bool true原创 2011-10-27 17:11:29 · 480 阅读 · 0 评论 -
some tips for objective-C
below tips comes from http://blog.csdn.net/kmyhy/article/details/57167551.使用class获得meta classNSLog(@"Class name: %@",[[[arr objectAtIndex:i] class] description]);2.使用NSClassFromString和 NSSelec转载 2011-10-28 16:38:39 · 1143 阅读 · 0 评论 -
ios实现国际化
在iPhone项目中如何才能国际化?难道同一个项目,非要写一个英文版的源代码,再写一个中文版的源代码?其实大可不必。我们可以使用iPhone的多语言支持来实现项目的本地(国际)化。1、新建Windows-base Application。打开main.m文件,在main函数中增加代码如下:// 取得用户默认信息NSUserDefaults *defaults = [ NSUserD转载 2011-10-18 16:06:02 · 8383 阅读 · 0 评论 -
在你的 iOS App中 使用 OpenSSL 库
看到有人介绍如何使用openssl的,这个在iphone上应该比较有用。在你的 iOS App中 使用 OpenSSL 库——译自x2on的“Tutorial: iPhone App with compiled OpenSSL 1.0.0a Library”原文地址:http://www.x2on.de/2010/07/13/tutorial-iphone-app-with-c转载 2011-10-30 19:16:01 · 647 阅读 · 0 评论 -
Mac 热键大全
这时我见到过的介绍最全的快捷键大全, 备忘屏幕捕捉快捷键动作............................保存到............-快捷键全屏捕捉........................桌面(.PDF文件)......Command + Shift + 3 (win+shift+3)屏幕部分画面....................桌面(.转载 2011-10-30 19:22:03 · 518 阅读 · 0 评论 -
如何往iphone模拟器中增加图片
Explain step by step of Airsource Ltd's answer for adding image to simulator:Drag it to simulator, then Safari opens (or browse to the Image in the internet using Safari)Hold your click on the原创 2011-11-19 21:48:06 · 860 阅读 · 0 评论 -
10个iPhone开发网站、论坛、博客
没事可以看看下面几个网站了,应该不错:整理了一下手中的iPhone开发网站、论坛和博客,精选了这10个常去的网站。其中有2篇教学文章,由于非常经典,于是单列出来,与其网站并列。 建议新入行的朋友在看教学文章的同时多上论坛,与大家交流,偶尔看看别人的自曝,自己也会信心倍增。另外,实践最重要,首先行动起来。 http://cocoachina.com/ 大量iPhone开发转载 2011-10-30 19:45:08 · 882 阅读 · 0 评论 -
xcode 4.2 bug of my mac 32-bit or my mac-64 bit
当xcode 4.2的工程文件被修改后( outside,可能别人修改了), xcode 4.2 就会显示my mac-64bit(我的机器上), stack overflow上有人说这时app dev确认的一个bug,会在xcode 4.2的下一个版本fix。解决方法是close code and reopen it。app的东西做的是很酷, 不过xcode的小问题一直不断,这个问题不知原创 2011-11-11 15:13:45 · 2186 阅读 · 0 评论