2012年11月15日

取得当前VIew或者UIImage某个点的RGB信息

摘要: (UIColor*) getPixelColorAtLocation:(CGPoint)point { UIColor* color = nil; CGImageRef inImage = self.image.CGImage; // Create off screen bitmap context to draw the image into. Format ARGB is 4 bytes for each pixel: Alpa, Red, Green, Blue CGContextRef cgctx = [self createARGBBitmapContextFromImage:inI 阅读全文

posted @ 2012-11-15 18:06 无量少年 阅读(301) 评论(0) 推荐(0) 编辑

消息通知方式设置旋转view

摘要: 看到这篇不错, 直接转载过来了, 没什么可解释的,一看就明白 :)出处: http://www.marsiphone.cn/tag/uidevice/整个程序需要支持横竖屏切换得时候,会比较简单,在每个ViewController 的- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation方法中,return YES; 就好。可如果只是要某个VC( = View Controller)支持横竖屏切换呢?单独在那个view controller中像上面那样做是没有效果的。 阅读全文

posted @ 2012-11-15 18:06 无量少年 阅读(170) 评论(0) 推荐(0) 编辑

《转载》iphone开发常用代码

摘要: 转自:我也叫梓珈的博客http://fei263.blog.163.com/更改cell选中的背景UIView *myview = [[UIView alloc] init];myview.frame = CGRectMake(0, 0, 320, 47);myview.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"0006.png"]];cell.selectedBackgroundView = myview;在数字键盘上添加button://定义一个消息中心[[NSNotif 阅读全文

posted @ 2012-11-15 18:05 无量少年 阅读(133) 评论(0) 推荐(0) 编辑

如何实现pushViewController:animated:的不同页面转换特效

摘要: 1. 首先要明确的是,不使用pushViewController的默认动画,所以在调用这个函数时,要将animated设置为NO.2. 使用普通的来CATransition实现转换效果,代码如下:显示代码打印01CATransition *animation = [CATransition animation];0203[animation setDuration:0.3];0405[animation setType: kCATransitionMoveIn];0607[animation setSubtype: kCATransitionFromTop];0809[animation se 阅读全文

posted @ 2012-11-15 18:04 无量少年 阅读(461) 评论(0) 推荐(0) 编辑

如何移动组件的位置,例如如何将UIAlertView显示在屏幕上部

摘要: 苹果自带的警告框非常好用,但是它总是显示在屏幕中间,我们如何将它的位置移动呢?从Iphone SDK3开始我们可以使用CGAffineTransformTranslateview plaincopy to clipboardprint?UIAlertView*alert=[[UIAlertViewalloc]initWithTitle:@"Alert"message:@"Alert"delegate:selfcancelButtonTitle:@"OK"otherButtonTitles:nil];alert.transform=CG 阅读全文

posted @ 2012-11-15 18:03 无量少年 阅读(212) 评论(0) 推荐(0) 编辑

静态类库(Static Library)详细教程

摘要: 原帖地址http://www.cocoachina.com/bbs/read.php?tid-8466-fpage-0-toread--page-1.html使用静态类库的好处: 加快编译速度。如果类文件多了,在编译的时候,特别是重新清除完Target之后,会特别慢。如果把某些不需要经常改动,但又很必须的类单独拿出来编译成静态类库,整个项目的编译速度将会大大提高。 方便代码共享。有些代码,不方便开源给别人,但又要提供给别人使用。比如,两个公司之间的合作。制作静态类库: 为方便讲解,更方便与初期代码测试,新建一个项目,StaticLibraryExample 新建Target。 假设我们需要制作 阅读全文

posted @ 2012-11-15 18:02 无量少年 阅读(1097) 评论(0) 推荐(0) 编辑

iPhone 实现图片的倒影

摘要: 在 viewDidLoad 方法中添加以下代码- (void)viewDidLoad { [super viewDidLoad]; [[[self view] layer] setBackgroundColor:[[UIColor blackColor] CGColor]]; UIImage *balloon = [UIImage imageNamed:@"b.jpg"]; CALayer *topLayer = [[CALayer alloc] init]; [topLayer setBounds:CGRectMake(0.0f, 0.0f, 320.0, 240)]; 阅读全文

posted @ 2012-11-15 18:01 无量少年 阅读(280) 评论(0) 推荐(0) 编辑

图片缩放代码

摘要: //// TouchMoveScaleView.h// TouchMoveScaleDemo//// Created by jimney on 07/05/10.// Copyright 2010 OpenSource. All rights reserved.//Welcome to my HomePage In CocoaChina:http://www.cocoachina.com/bbs/u.php?action=topic#import <UIKit/UIKit.h>#import <QuartzCore/QuartzCore.h>/**类说明*此类主要实现在 阅读全文

posted @ 2012-11-15 18:01 无量少年 阅读(624) 评论(0) 推荐(0) 编辑

iphone开发中的一些小技

摘要: 在iPhone开发过程中,一些小技巧对开发工作有很大的帮助作用,所以以下内容收集了一些开发过程中的小技巧。1、如果在程序中想对某张图片进行处理的话(得到某张图片的一部分)可一用以下代码: UIImage *image = [UIImage imageNamed :filename];CGImageRef imageRef = image.CGImage ;CGRect rect = CGRectMake (origin.x , origin.y ,size.width , size.height );CGImageRef imageRefRect = CGImageCreateWithImag 阅读全文

posted @ 2012-11-15 17:59 无量少年 阅读(188) 评论(0) 推荐(0) 编辑

view放大再缩小的动画

摘要: CABasicAnimation *animationZoomIn=[CABasicAnimation animationWithKeyPath:@"transform.scale"]; // roAnim.fromValue = [NSNumber numberWithFloat:0]; animationZoomIn.duration=0.5f; animationZoomIn.autoreverses=NO; animationZoomIn.repeatCount=0; animationZoomIn.fromValue = [NSNumber numberWithF 阅读全文

posted @ 2012-11-15 17:58 无量少年 阅读(230) 评论(0) 推荐(0) 编辑

导航