`
文章列表
最近测试,发现64位版本的JDK运行速度竟然赶不上开发机上的32位版本。   1. 64位耗内存更加厉害。如果在32位,趋于某个Xmx临界值能顺利跑完,那么放到64位上肯定OOM。 2. 64位某些API耗时比32位更严重,比如sysout.
在网上搜了下,确实只能用如下步骤来进行:   1) Create the project in XCODE. 2) Setup subversion in XCODE and select the subversion repository for this project. 3) Use Xcode SCM > Repository and click on the IMPORT icon. This will move the local copy to the subversion repository. 5) Now delete your local copy ...

iPhone LineChart

说实话,OC代码写着真的很别扭,速度明显慢N倍. 下面是一个简单的line chart,虽然很难看,但是好歹照虎画猫也能弄个模子出来... #define AXIS_Y_ITEM_COUNT 5 #define AXIS_X_ITEM_COUNT 5 NSMutableArray* radom_data() { srand((unsigned)time(NULL)); float base = 30; NSMutableArray *array = [[NSMutableArray alloc] init]; for (int i = 0; i &l ...
核心函数是:CGContextAddArc(CGContextRef c, CGFloat x, CGFloat y, CGFloat radius, CGFloat startAngle, CGFloat endAngle, int clockwise)   CGContextRef: 图形上下文 x,y: 开始画的坐标 radius: 半径 startAngle, endAngle: 开始的弧度,结束的弧度 clockwise: 画的方向(顺时针,逆时针) 有了这个函数可以画出任意扇形,所以饼图也不再话下.  #define PI 3.14159265358979 ...
  quartz属于core graphic framework的一部分. 为什么都说quartz的坐标系都在左下角呢?因为那是在mac x os里面,如果在iPhone OS中,坐标系是左上角的.     Note: If you are using Quartz 2D for an iPhone application, make sure you understand the native coordinate system of iPhone OS. Its origin is located at the upper left. For more details, se ...
按照我的想法,如果用户没有在setting设置值且有default-value,那么应该获取的是default-value,因为打开setting也能看见这些值.但是今天突然发现好像不是那么会事.获取的是null.看了AppPrefs的代码,它也进行了判断.如下:     - (void)applicationDidFinishLaunching:(UIApplication *)application { [window addSubview:[navigationController view]]; NSString *testValue = [[NSUserDefau ...
今天升级到iOS4, xCode也升级到3.2.3, 但是打开以前的工程老师报告:error: There is no SDK with the name or path 'iphoneos3.0' 类似于这样的字样,而左上角也写着base sdk missing.   当出现这样的问题,需要手动配置一下原有的sdk.如图,双击他们,然后找到相应的标签设置下就可以了.     双击第一个,然后选择build标签,设置下..  双击第二个,同样设置下,就OK啦.
[webView stringByEvaluatingJavaScriptFromString: jsCode];
[[UIApplication sharedApplication] openURL:@"www.baidu.com"];  
系统音频播放的格式很少,而且不支持太大的音频文件,但是它是最简单的可以使设备响起来的一种方法,而且开销是最小的.仅仅需要几行代码.   支持:AIFF,WAV,CAF等格式.     SystemSoundID pmph; id sndpath = [[NSBundle mainBundle] pathForResource:@"pmph1" ofType:@"wav" inDirectory:@"/"]; CFURLRef baseURL = (CFURLRef)[[NSURL alloc] initFileURL ...
当文本输入时, 文本框有几中选择用于辅助输入: textField.clearButtonMode = UITextFieldViewModeWhileEditing; typedef enum { UITextFieldViewModeNever, //clear button 永远不出现 UITextFieldViewModeWhileEditing, //编辑的时候出现 UITextFieldViewModeUnlessEditing, //未编辑的时候出现 UITextFieldViewModeAlways //永远都出现 } ...
@implementation BrightnessController // MyCreateBitmapContext: Source based on Apple Sample Code CGContextRef MyCreateBitmapContext (int pixelsWide, int pixelsHigh) { CGContextRef context = NULL; CGColorSpaceRef colorSpace; void * bitmapData; int ...
navigation bar 分为三个部分,左按钮,右按钮和中间的View. 在Controller中可以通过以三个方式来引用:   self.navigationItem.titleView self.navigationItem.leftBarButtonItem self.navigationItem.rightBarButtonItem 左右按钮可以使用UIBarButtonItem来构造. 他默认有很多种按钮可攻选择: typedef enum { UIBarButtonSystemItemDone, UIBarButtonSyst ...
不知道4.0SDK带有手势的直接支持没有,至少3.2已经可以用了.但是如果想支持早期的版本,那么手势的识别无疑是一种痛苦,因为需要自己写代码来判定手势...   下面代码是判断一个滑动的手势(swipe),虽然很简单但是总体思想就是这样了.当在一个水平,或者纵向滑动时给出一个滑动距离以及偏移量.当实际滑动距离超过指定的距离,且水平或者纵向的偏移量小于指定的偏移量则视为这个滑动手势判定成功!   - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = touches.a ...
在iPhone中动画过度非常简单.   首先获取当前的图形上下文: CGContextRef context = UIGraphicsGetCurrentContext();   接着设置一些动画属性用于开始动画:   [UIView beginAnimations:nil context:context]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration:1.0];   然后设置想要过度的对象的最终状态.   [big setFrame:SMA ...
Global site tag (gtag.js) - Google Analytics