摘要: 国安是冠军 阅读全文
posted @ 2017-03-02 16:08 白条围巾 阅读(148) 评论(0) 推荐(0) 编辑
摘要: UIScrollView有一个属性叫做scrollToTop,是个BOOL值,默认为YES。它的作用是定义当前的这个UIScrollView的delegate在接收到点击状态条消息时候要不要进行返回顶部的操作。好的,那么一个问题是,当当前的VC上有多个UIScrollView及其子类的时候,会使得所... 阅读全文
posted @ 2015-10-28 16:01 白条围巾 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 类似于java5提供的autoboxing功能。以前的写法:NSNumber * number = [NSNumber numberWithInt:1];NSArray * array = [NSArray arrayWithObjects:@"one", @"two",nil];NSDictionary * dict = [NSDictionarydictionaryWithObjectsAndKeys:@"value1", @"key1", @"value2",@"key2&quo 阅读全文
posted @ 2014-04-01 18:34 白条围巾 阅读(246) 评论(0) 推荐(0) 编辑
摘要: //绘制背景渐变 /* CGCradientCreateWithColorComponents函数需要四个参数: 色彩空间:(Color Space)这是一个色彩范围的容器,类型必须是CGColorSpaceRef.对于这个参数,我们可以传入CGColorSpaceCreateDeviceRGB函数的返回值,它将给我们一个RGB色彩空间。 颜色分量的数组:这个数组必须包含CGFloat类型的红、绿、蓝和alpha值。数组中元素的数量和接下来两个参数密切。从本质来讲,你必须让这个数组包含足够的值,用来指定第四个参数中位置的数量。所以如果你需要两个位置位置(起点和终点... 阅读全文
posted @ 2013-10-29 15:26 白条围巾 阅读(4363) 评论(0) 推荐(0) 编辑
摘要: http://blog.sina.com.cn/s/blog_45e2b66c010102h9.html 上面这篇文章将剪贴板的使用方法基本上已经讲清楚了,参考这篇文章,再加上一个使用剪贴板共享数据的开源项目,基本上能将这一块内容搞定。不过在上面这篇文章中,有一个错误。对应自定义剪贴板,文中说剪贴板的所有者是最后一次对数据进行写入的那个应用,而且如果设置persistent值为YES,只有在这个应用被删除之后,剪贴板中的值才会被清空。而在若干次实验后发现,只有将创建剪贴板的应用卸载,剪贴板的内容才会被清空,后来查看文档后有这么一句话:A persistent application pa... 阅读全文
posted @ 2013-07-30 15:31 白条围巾 阅读(231) 评论(0) 推荐(0) 编辑
摘要: Targets选项下有Other linker flags的设置,用来填写XCode的链接器参数,如:-ObjC -all_load -force_load等。还记得我们在学习C程序的时候,从C代码到可执行文件经历的步骤是: 源代码 > 预处理器 > 编译器 > 汇编器 > 机器码 > 链接器 > 可执行文件在最后一步需要把.o文件和C语言运行库链接起来,这时候需要用到ld命令。源文件经过一系列处理以后,会生成对应的.obj文件,然后一个项目必然会有许多.obj文件,并且这些文件之间会有各种各样的联系,例如函数调用。链接器做的事就是把这些目标文件和所用的一些 阅读全文
posted @ 2013-05-27 10:26 白条围巾 阅读(37571) 评论(0) 推荐(4) 编辑
摘要: 1.首先需要了解iTunesConnect的作用: AP发布 管理App 创建管理项目信息 项目付费产品(道具)管理 付费的测试账号 提交App 等等2.在iTunesConnect中创建付费产品 四种付费产品: 1.Consumable(消耗品): 每次下载都需要付费; 2.Non-consumable(非消耗品): 仅需付费一次; 3.Auto-Renewable Subscriptions:自动订阅 4.Free Subscription:免费订阅3.注意在做内购的时候应该实现恢复交易才能在apple的审核通过两个参考博客http://blog.csdn.net/... 阅读全文
posted @ 2013-04-18 10:02 白条围巾 阅读(331) 评论(0) 推荐(0) 编辑
摘要: 1.$mongod---------启动mongodb服务器2.$redis-server-----------启动redis-server服务3.进入cpassport2目录---------$rails s--------默认3000端口启动cpassport4.进入idea目录---------$padrino s -p 3002-------3002端口启动社区5.$padrino rake rescue:work QUEUE=*-------开启resque任务6.padrino console--------进入padrino控制台7.若Oauth无法验证,则只有可能是数据错误,这 阅读全文
posted @ 2013-04-18 09:55 白条围巾 阅读(289) 评论(0) 推荐(0) 编辑
摘要: 网上看见的一种解决自定义相机时候相机开启动画不一致的方法,用于CV项目。cameraOverlayView.view.alpha = 0.0f;// animate the fade in after the shutter opens[UIViewbeginAnimations:nilcontext:NULL];[UIViewsetAnimationDelay:0.85f];cameraOverlayView.view.alpha = 1.0f;[UIViewcommitAnimations]; 阅读全文
posted @ 2013-02-22 15:32 白条围巾 阅读(495) 评论(0) 推荐(0) 编辑
摘要: 需要注意的是,要做缓存的Http请求必须用get方法来获取数据。1、设置全局的Cache 在AppDelegate.h中添加一个全局变量@interface AppDelegate : UIResponder <UIApplicationDelegate> { ASIDownloadCache *myCache; } @property (strong, nonatomic) UIWindow *window; @property (nonatomic,retain) ASIDownloadCache *myCache; 在AppDelegate.m中的- (BOOL)applic 阅读全文
posted @ 2013-01-28 10:02 白条围巾 阅读(5060) 评论(0) 推荐(1) 编辑
摘要: assert 是C里面的宏,用于断言。NSAssert 只能在OC里面使用。是assert的一个扩充。能捕获assert异常,打印一些可读的日志。而assert只是让app crash(abort).在debug情况下,所有NSAssert都会被执行。在release下不希望NSAssert被执行的设置方法:在targets种选择build,选择release。在gcc preprocessing下增加Preprocessor Macros 值为 NS_BLOCK_ASSERTIONS.assert宏的原型定义在<assert.h>中,其作用是如果它的条件返回错误,则终止程序执行, 阅读全文
posted @ 2013-01-23 09:51 白条围巾 阅读(989) 评论(0) 推荐(0) 编辑
摘要: // 右边索引的标题数组- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView{ NSMutableArray *array = [NSMutableArray array]; for(int section='A';section<='Z';section++) { [array addObject:[NSString stringWithFormat:@"%c",section]]; } return array;}// 自定义索引与数组的对应关系- 阅读全文
posted @ 2013-01-21 18:45 白条围巾 阅读(5661) 评论(0) 推荐(0) 编辑
摘要: 导入MessageUI.framework.h文件中#import<MessageUI/MessageUI.h>#import<MessageUI/MFMailComposeViewController.h>实现MFMailComposeViewControllerDelegate,MFMessageComposeViewControllerDelegate.m文件//邮件-(void)showMailPicker { ClassmailClass = (NSClassFromString(@"MFMailComposeViewController" 阅读全文
posted @ 2013-01-21 16:09 白条围巾 阅读(3147) 评论(0) 推荐(0) 编辑
摘要: //sdk中提供了方法可以直接调用UIImage*img=[UIImageimageNamed:@"some.png"];NSData*dataObj=UIImageJPEGRepresentation(img,1.0); //下面是sdk中UIImage.h头文件中的内容UIKIT_EXTERNNSData*UIImagePNGRepresentation(UIImage*image);//returnimageasPNG.MayreturnnilifimagehasnoCGImageReforinvalidbitmapformatUIKIT_EXTERNNSData*U 阅读全文
posted @ 2013-01-21 16:08 白条围巾 阅读(42551) 评论(0) 推荐(1) 编辑
摘要: 缩放图片比例- (UIImage *)TelescopicImageToSize:(CGSize) size{ UIGraphicsBeginImageContext(size); [self drawInRect:CGRectMake(0, 0, size.width, size.height)]; UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return newImage;} 阅读全文
posted @ 2013-01-18 22:37 白条围巾 阅读(3537) 评论(0) 推荐(0) 编辑
摘要: - (void)scrollViewDidScroll:(UIScrollView *)scrollView{ [self pageScroll]; [self.refreshHeaderView headFreshScrollViewDidScroll:scrollView]; //+|+ NSLog(@"%f",scrollView.contentOffset.y); if (scrollView.contentOffset.y<0) { CGRect frame = CGRectMake(0, -20, 320, 40); ... 阅读全文
posted @ 2013-01-17 11:58 白条围巾 阅读(3281) 评论(0) 推荐(0) 编辑
摘要: 黑白0.3086, 0.6094, 0.0820, 0, 00.3086, 0.6094, 0.0820, 0, 00.3086, 0.6094, 0.0820, 0, 00 , 0 , 0 , 1, 0对比度(N取值为0到10)N,0,0,0,128*(1-N)0,N,0,0,128*(1-N)0,0,N,0,128*(1-N)0,0,0,1,0亮度(N取值为-255到255) 注:一般取值为-100到100(这里是PS中的取值宽度)1,0,0,0,N0,1,0,0,N0,0,1,0,N0,0,0,1,0颜色反相-1, 0, 0, 0, 2550 , -1, 0, 0, 2550 , 0, 阅读全文
posted @ 2013-01-04 15:58 白条围巾 阅读(449) 评论(0) 推荐(0) 编辑
摘要: #define kBgQueue dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)- (void)viewDidLoad{ [super viewDidLoad]; dispatch_async(kBgQueue, ^{ NSData* data = [NSData dataWithContentsOfURL: kLatestKivaLoansURL]; [self performSelectorOnMainThread:@selector(fetchedData:) withOb... 阅读全文
posted @ 2013-01-01 14:37 白条围巾 阅读(247) 评论(0) 推荐(0) 编辑
摘要: static Singleton *sharedSingleton = nil;+(Singleton *)sharedInstance{ if (sharedSingleton == nil) { sharedSingleton = [[super allocWithZone:NULL] init]; } return sharedSingleton;}+(id)allocWithZone:(NSZone *)zone{ return [[self sharedInstance] retain];}-(id)copyWithZone:(NSZone *)... 阅读全文
posted @ 2012-12-26 09:54 白条围巾 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2012-12-20 13:35 白条围巾 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 在引用计数方式下,二者没有什么不同,你通常要使用drain在GC(garbage-collected)环境下,drain会在必要时引起GC作用,然而release是个空操作。http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSAutoreleasePool_Class/Reference/Reference.html#//apple_ref/doc/uid/20000051-SW5In a garbage-collected environment, there is 阅读全文
posted @ 2012-12-13 01:12 白条围巾 阅读(1550) 评论(0) 推荐(0) 编辑
摘要: //长按事件的手势监听实现方法- (void) myHandleTableviewCellLongPressed:(UILongPressGestureRecognizer *)gestureRecognizer { if (gestureRecognizer.state == UIGestureRecognizerStateBegan) { NSLog(@"UIGestureRecognizerStateBegan"); } if (gestureRecognizer.state == UIGestureRecognizerStateChanged) { ... 阅读全文
posted @ 2012-12-02 16:17 白条围巾 阅读(1973) 评论(0) 推荐(0) 编辑
摘要: procedureopenGLdraw;beginglEnable(GL_LINE_SMOOTH); //设置反走样glHint(GL_LINE_SMOOTH_HINT,GL_NICEST); //设置反走样‍ glColor4f(1.0,1.0,0.0,1.0); // 设置黄色,透明度为100%glLineWidth(10); // 设置线的宽度glBegin(GL_LINE_STRIP);// 画线 glvertex3f(-3,0.5,0); glVertex3f(0,0.8,0); glVertex3f(3,-0.5,0);glEnd(); //end; 阅读全文
posted @ 2012-11-29 11:29 白条围巾 阅读(3309) 评论(0) 推荐(0) 编辑
摘要: 众所周知,iOS5之前,iPhone上的键盘的高度是固定为216.0px高的,中文汉字的选择框是悬浮的,所以不少应用都将此高度来标注键盘的高度(包括米聊也是这么做的)。 可是在iOS5中,键盘布局变了,尤其是中文输入时,中文汉字选择框就固定在键盘上方,这样就使得原本与键盘紧密贴合的界面视图被中文汉字选择框给覆盖住了。一方面影响了界面的美观,另一方面,如果被覆盖的部分就是文本输入框的话,用户就无法看到输入的内容了。因此这个问题就必须得解决了。解决方法: 其实在一开始使用216.0px这个固定值来标注键盘的高度就是错误的。因为在iOS3.2以后的系统中,苹果就提供了键盘使用的API以及Demo.. 阅读全文
posted @ 2012-11-26 20:36 白条围巾 阅读(422) 评论(0) 推荐(0) 编辑
摘要: 获得屏幕可见的行的索引[self.tableView indexPathsForVisiableRows];转自:http://xmuliushuo.com/archives/20在ios4.0及以后鼓励使用animateWithDuration方法来实现动画效果。当然,以往的begin/commit的方法依然使用,下面详细解释一下animateWithDuration的使用方法。函数原型:+ (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations+ (void)anima 阅读全文
posted @ 2012-11-26 20:35 白条围巾 阅读(590) 评论(0) 推荐(0) 编辑
摘要: 错误提示:*** Assertion failure in -[CCTouchDispatcher forceAddHandler:array:]*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Delegate already added to touch dispatcher.'分析:在触摸屏幕时,会调用下面的伪代码,其中idx是一种枚举类型,表示Touchbegin、TouchEnd等等 1 -(void) touches:( 阅读全文
posted @ 2012-11-21 11:31 白条围巾 阅读(293) 评论(0) 推荐(0) 编辑
摘要: ccLabelttf不能设置背景色,必须的话可以在后面加一个等大小的只带颜色的ccSprite来实现 阅读全文
posted @ 2012-11-17 17:52 白条围巾 阅读(243) 评论(0) 推荐(0) 编辑
摘要: 于精灵的各种操作,总结一下以便以后复习查找。内容简要:1、初始化 2、创建无图的精灵 3、设置精灵贴图大小 4、添加入层中5、对精灵进行缩放 6、对精灵款或高进行缩放 7、旋转精灵8、设置精灵透明度 9、精灵的镜像反转 10、设置精灵的颜色11、得到图的宽高 12、按照像素设定图片大小 13、在原有的基础上加xy的坐标14、设置图片锚点 15、从新排列z轴顺序 16、更换精灵贴图17、设置可视区域 18、贴图无锯齿//初始化CCSprite* sprite =[CCSprite spriteWithFile:@"Icon.png"];//创建无图的精灵CCSprite*sp 阅读全文
posted @ 2012-11-17 17:25 白条围巾 阅读(325) 评论(0) 推荐(0) 编辑
摘要: 要在页面上显示文字,就要用到这个类了。如下。1) CCLabelTTF *labelA = [CCLabelTTF labelWithString:@“Hello”fontName:@"Marker Felt" fontSize:25]; labelA.color = ccBLUE; labelA.position = ccp(225, 600); [self addChild:labelA z:2];最简单的,在页面上225,600的位置显示一个蓝色的Hello。字体是"Marker Felt" 大小是25号2) CCLabelTTF *label = 阅读全文
posted @ 2012-11-17 12:34 白条围巾 阅读(230) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2012-11-14 21:03 白条围巾 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2012-11-14 21:02 白条围巾 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 1.write to方式保存到沙盒目录下的documents文件夹下:这种方式适合字符串数组的存储。//获得当前程序的沙盒目录路径NSString *path = NSHomeDirectory();//拼接要保存的文件全路径,这个方法会自动在@“Document...”前面加斜杠path = [path stringByAppendingPathComponent:@"Documents/student.plist"];///从文件创建数组NSArray *array = [NSArray arrayWithContentsOfFile:path];//将内容写入文件中[ 阅读全文
posted @ 2012-11-14 20:45 白条围巾 阅读(4197) 评论(0) 推荐(1) 编辑
摘要: 主要是UIImagePickerControllerDelegate协议的实现- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *oneTouch = [touches anyObject]; UIView *touchView = oneTouch.view; // 判断如果点击到图片了 if (touchView == previewImageView) { UIImagePickerController *ipc = [[UIImagePickerC... 阅读全文
posted @ 2012-11-14 18:04 白条围巾 阅读(353) 评论(0) 推荐(0) 编辑
摘要: 服务器文档部分9.创建新相册 /my/create_album.php参数说明: 参数名称 必选 类型 说明 albumname TRUE String 相册名称 privacy TRUE int 隐身设置,可以选择值为: 0:全站用户可见1:全好友可见 2:仅指定的好友可见3:仅自己可见 4:凭密码查看返回值 {"code": "do_success","message": "进行的操作完成了"“id” : “111”} 10.获取相册列表 /my/album_list.php 返回值返回值参考 user_lis 阅读全文
posted @ 2012-11-14 17:56 白条围巾 阅读(323) 评论(0) 推荐(0) 编辑
摘要: 服务端文档:1.登录 /my/login.php 输入参数: username password 例如: username=test&password=123456 输出响应:<result><code>login_success</code><uid>登录成功</uid><message>登录成功</message><m_auth>f06eYFOrTIA/QmDa4mNEr1QJYeMeXi+Nfy5JF2441xNA4m5Cd192+VOkFT3Te1pYomXeU0SuMvWpMn5d 阅读全文
posted @ 2012-11-14 17:26 白条围巾 阅读(469) 评论(0) 推荐(0) 编辑
摘要: 服务端文档:注册 /my/register.php 输入参数: 参数说明: username 用户名 password 密码 email 邮箱 成功返回值:{"code": "registered","message": "注册成功了,进入个人空间"} 注册失败: {"code": "user_name_already_exists","message": "用户名已经存在"}导入的包:// GET#import "ASIHt 阅读全文
posted @ 2012-11-14 17:14 白条围巾 阅读(3419) 评论(0) 推荐(0) 编辑
摘要: UIViewAutoresizingNone = 0,UIViewAutoresizingFlexibleLeftMargin = 1 << 0,UIViewAutoresizingFlexibleWidth = 1 << 1,UIViewAutoresizingFlexibleRightMargin = 1 << 2,UIViewAutoresizingFlexibleTopMargin = 1 << 3,UIViewAutoresizingFlexibleHeight = 1 << 4,UIViewAutoresizin... 阅读全文
posted @ 2012-11-14 16:13 白条围巾 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 方法1:能够使得背景图片可以拉伸。UIView *theMainView =[ [UIView alloc] init];UIImage *image = [UIImage imageNamed:@"bg.png"];UIImageView *imageView = [[UIImageView alloc] initWithImage:image] ;[theMainView addSubview:imageView];//这个方法两个参数分别表示左边和上边不拉升的像素UIImageView *bubble=[[UIImageView alloc] initWithImag 阅读全文
posted @ 2012-11-10 16:02 白条围巾 阅读(847) 评论(0) 推荐(0) 编辑
摘要: #!/bin/sh#basename `pwd`cd `dirname $0`alias pngcrush="/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush -revert-iphone-optimizations "mkdir new;for i in `ls *.png`;do pngcrush $i new/$i; mv new/$i $i; donerm -rf new; 上面的脚本内容用于还原ipa包中的所有png图片。 将ipa里的题片提取出来,作为UI设计部分的参考。 1、将i 阅读全文
posted @ 2012-11-09 17:06 白条围巾 阅读(1152) 评论(0) 推荐(0) 编辑
摘要: 日期格式转换方法 //日期转换方法-(NSString *)formatTimeStr:(NSString *)timeStr{ NSDate *Date; //新建一个Date格式类, NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; //设置为timeStr的日期格式 [dateFormatter setDateFormat:@"EEE, dd MMM yyyy HH:mm:ss z"]; //以timeStr的格式来得到Date Date = [dateForm... 阅读全文
posted @ 2012-11-09 10:58 白条围巾 阅读(422) 评论(0) 推荐(0) 编辑