Quantcast
Channel: C++博客-所有随笔
Browsing all 7881 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

原:ios中没有好的Ioc (类似于java的Spring)

创建:120620iOS无法使用IoC,没有好的库。只有Objection和Syringe。都无法读配置文件,更不必说“Spring Expression Language (SpEL)”了。进而,无法在UnitTest中,重新配置。+++++佳为好友 2012-12-29 10:52 发表评论

View Article


Image may be NSFW.
Clik here to view.

原:c++的A?B:C表达式可以忽略B这个参数

创建:2012.06.11c++的A?B:C表达式可以忽略B这个参数A?:C相当于A?A:C很简便的写法。+++++佳为好友 2012-12-29 10:53 发表评论

View Article


Image may be NSFW.
Clik here to view.

转:When to use NSOperation vs. GCD

创建:2012.05.23转:http://stackoverflow.com/questions/7651551/why-should-i-choose-gcd-over-nsoperation-and-blocks-for-high-level-applications第一种观点:转:http://eschatologist.net/blog/?p=232Mac OS X has a...

View Article

Image may be NSFW.
Clik here to view.

转:ios4与ios3兼容 -4 --Tips & Tricks for conditional iOS3, iOS3.2 and iOS4 code...

转:http://cocoawithlove.com/2010/07/tips-tricks-for-conditional-ios3-ios32.html[2012.5.18:使用[[UIDevice currentDevice]...

View Article

Image may be NSFW.
Clik here to view.

转:UILabel的字模糊

创建:2012.04.30转:http://stackoverflow.com/questions/8065892/blurry-uilabel-when-added-programatically原因是:UILabel的frame中有浮点值,或者是UILabel的superview的frame有浮点值。解决方法是:将所有的浮点值变为整数值。可以使用CGRectIntegral函数,例如:[load...

View Article


Image may be NSFW.
Clik here to view.

原:关于时间NSDate, NSCalendar, NSDateComponents --2011.11.06

创建:2011.09.15修改:2011.10.18修改:2011.11.06NSDate对象相当于一个时间点,是绝对的。NSDate考虑事情都是通过转换为NSTimeInterval来进行的.==========NSDate objects store dates in absolute time. For example, the date object created in Listing...

View Article

Image may be NSFW.
Clik here to view.

关于centos 5.5 程序中编译出现curses.h不存在问题(转)

  检查是否已经安装以下的辅助软件包          [root@localhost ~]# rpm -q ncurses          ncurses-5.5-24.          [root@localhost ~]#  rpm -q ncurses-devel          package ncurses-devel is not installed...

View Article

Image may be NSFW.
Clik here to view.

原:printf格式化字符串说明

创建:2012.04.11[自:NSString的格式说明比这个要多不少。但是printf是基础,它们都遵守。]参考:http://www.cplusplus.com/reference/clibrary/cstdio/printf/格式:%[flags][width][.precision][length]specifier...

View Article


Image may be NSFW.
Clik here to view.

转:块编程指南

创建:2012.04.09[自:块跟函数指针类似。普通函数变量传入进去,相当于传值,但是却不可以改。__block变量进去相当于传递static指针。分配释放等工作其实不必太考虑,底层处理的很好。]转:http://blog.csdn.net/kmyhy/article/details/6447287——译自Apple Reference Library《Blocks Programming...

View Article


Image may be NSFW.
Clik here to view.

原:UIWindowLevelAlert导致UIAlertView无法显示

创建:2012.04.08Loading页面放到了一个自定义的window下,该window的windowLevel =UIWindowLevelAlert;会导致后来弹出的Alert无法显示。修改方法是,将windowLevel设置为UIWindowLevelStatusBar。+++++佳为好友 2012-12-29 10:58 发表评论

View Article

Image may be NSFW.
Clik here to view.

转:Using Blocks in iOS 4 --2

创建:2010-08-09修改:2012-04-06转:http://pragmaticstudio.com/blog/2010/7/28/ios4-blocks-1[自:看原文更清楚,因为有各种颜色的高亮。][自:几个关键之处:1,Block内可以使用其前声明的变量值,但是该变量值即使再后来进行了改动,也不会影响到Block中的值,也就是说,类似与传递一个一个值传递的参数!2,Block定义时,可...

View Article

Image may be NSFW.
Clik here to view.

转:stop NSInvocationOperation

创建:2012.03.29转:http://stackoverflow.com/questions/763003/how-to-stop-an-nsinvocationoperation][自:NSInvocationOperation用起来很方便,但是却没有办法stop,所以在target退出的时候,不能很好的终止op。好在当执行[operation initWithTarget:self...

View Article

Image may be NSFW.
Clik here to view.

转:UITextField的键盘在 "form sheet" style的 model view controller中不会自动消失

创建:2012.03.29转:http://stackoverflow.com/questions/8379205/uitextfields-keyboard-wont-dismiss-no-reallyThe Apple docs describe this exception:On the iPad, if a view controller modally presents its view...

View Article


Image may be NSFW.
Clik here to view.

原:GPS定位的一些经验Tip -2

创建:2011.06.02修改:2012.03.28iOS5:*系统的定位功能有2个设置。第一,设置是否在本机禁用定位功能;第二,设置是否允许某程序使用定位功能。*[CLLocationManager locationServicesEnabled] 用于检测第一种情况。*[CLLocationManager authorizationStatus] !=...

View Article

Image may be NSFW.
Clik here to view.

原:iPhone内存警告 -3

创建:2011.06.27修改:2012.03.15修改:2012.03.26参见附件。补充:ipad 2,ios4.3 测试: *memory warning不会打断一个函数的执行。所以,一个函数如果消耗太多内存,则收不到memory...

View Article


Image may be NSFW.
Clik here to view.

转:让UIWebView背景透明

创建:2012.03.22转: I recommend:webView.opaque = NO; webView.backgroundColor = [UIColor clearColor]; (for some reason it didn't work to set those properties via IB) and include this into your HTML...

View Article

Image may be NSFW.
Clik here to view.

转:修改UIModalPresentationFormSheet风格的model view controller的宽高

创建:2012.03.16转:http://stackoverflow.com/questions/2457947/how-to-resize-a-uipresentationformsheetYou are able to adjust the frame of a modal view after presenting it:MyModalViewController...

View Article


Image may be NSFW.
Clik here to view.

原:去掉UITableView的分割线

创建:2012.03.15如果是UITableViewStylePlain类型的UITableView,则可以直接调用tableview.separatorStyle = UITableViewCellSeparatorStyleNone;tableview.separatorColor = [UIColor...

View Article

Image may be NSFW.
Clik here to view.

捕获Linux段错误(Segment fault)并且打印错误堆栈

Linux上跑服务器如果遇到程序崩溃是一件很苦恼的事情, 再碰到重现很难的BUG, 估计只能通过传统的排查方法进行. 在编写本文前, 笔者使用过诸如libunwind等库进行错误时堆栈打印, 但是其本身由于需要引用第三方库, 使用还是稍微麻烦. 经过Google后, 居然找到一篇好文, 其通过捕获SIGSEGV信号, 并迫使程序进入gdb调试阶段, 利用gdb强大的调试功能可以进行各种错误跟踪,...

View Article

Image may be NSFW.
Clik here to view.

转:让代码自动发送内存不足的消息

转:http://idevrecipes.com/2011/05/04/debugging-magic-auto-simulate-memory-warnings/日期:120103[自:亲自测试:该消息只能在ios4上使用,在ios5上则不会发送内存不足的消息。][自:这种方法能够完全测试内存不足情况下的问题,避免遗忘,推荐。]Full Source code:...

View Article
Browsing all 7881 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>