Fork me on GitHub
上一页 1 ··· 83 84 85 86 87 88 89 90 91 ··· 125 下一页

2012年2月20日

摘要: You’ll want to readthis post from 2011: HJCache– we’ve released a comprehensive library for free that makes it easy to use dynamically loaded and cached images in your iOS apps, as per this intro article…Readers… do look through the comments if you plan to use this code, other people have posted imp 阅读全文
posted @ 2012-02-20 19:28 pengyingh 阅读(317) 评论(0) 推荐(0)
摘要: 为Sprite添加下面的方法:[[spritetexture]setAliasTexParameters]; 阅读全文
posted @ 2012-02-20 19:26 pengyingh 阅读(200) 评论(0) 推荐(0)
摘要: -(UIImage *)imageFromText:(NSString *)text width:(float)width height:(float)height{ // set the font type and size UIFont *font = [UIFont systemFontOfSize:12.0]; CGSize size = CGSizeMake(width, height);// [text sizeWithFont:font]; // check if UIGraphicsBeginImageContextWithOptions is available (iOS i 阅读全文
posted @ 2012-02-20 19:22 pengyingh 阅读(545) 评论(0) 推荐(0)
摘要: #import <Foundation/Foundation.h>int main (int argc, const char * argv[]){ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSString *path = @"/Users/billchen/Desktop/f1.rtf"; NSString *temp = @"Hello Friend"; int i = 100; float f = 98.3333f; NSMutableData *writ 阅读全文
posted @ 2012-02-20 19:20 pengyingh 阅读(4201) 评论(0) 推荐(0)
摘要: #include <math.h>#define pi 3.14159265358979323846#define degreesToRadian(x) (pi * x / 180.0)#define radiansToDegrees(x) (180.0 * x / pi)CGFloat distanceBetweenPoints (CGPoint first, CGPoint second) { CGFloat deltaX = second.x - first.x; CGFloat deltaY = second.y - first.y; return sqrt(deltaX* 阅读全文
posted @ 2012-02-20 19:04 pengyingh 阅读(243) 评论(0) 推荐(0)
摘要: http://www.cnblogs.com/chenjunbiao/archive/2011/05/10/2041895.html定义一个Photo类,并带有2个draw方法, 一个带参数、一个不带参数。Photo.h#import <Foundation/Foundation.h>@interface Photo : NSObject {@private }-(void) draw;-(void) draw:(NSNumber*) number;@endPhoto.m#import "Photo.h"@implementation Photo- (id)in 阅读全文
posted @ 2012-02-20 19:03 pengyingh 阅读(289) 评论(0) 推荐(0)
摘要: NSArray *arr = [self.webview subviews];UIScrollView *scrollview = [arr objectAtIndex:0];//得到webview子视图里的scrollview视图CGSize sixzevid=scrollview.contentSize;CGPoint oriOffsetPoint = scrollview.contentOffset;UIGraphicsBeginImageContext(sixzevid);CGFloat height = scrollview.contentSize.height;CGFloat wi 阅读全文
posted @ 2012-02-20 18:54 pengyingh 阅读(571) 评论(0) 推荐(0)
摘要: 处理单个和多个触碰手势iPhone应用程序中一个很常见的手势是触击:即用户用手指触碰一个对象。响应者对象可以以一种方式响应单击,而以另外一种方式响应双击,甚至可能以第三种方式响应三次触击。您可以通过考察UITouch对象的tapCount属性声明值来确定用户在一个响应者对象上的触击次数,取得这个值的最好地方是touchesBegan:withEvent:和touchesEnded:withEvent:方法。在很多情况下,我们更倾向于后者,因为它与用户手指离开屏幕的阶段相对应。在触摸结束阶段(UITouchPhaseEnded)考察触击的次数可以确定手指是真的触击,而不是其它动作,比如手指接触屏 阅读全文
posted @ 2012-02-20 18:51 pengyingh 阅读(616) 评论(0) 推荐(0)
摘要: UIScrollView,点击、滑动翻页事件的区分http://blog.csdn.net/gavinming/article/details/6552565最近看到有人问这个问题:在UIScrollView上添加了一个View,View上面有图片等元素,需要对单击和滑动事件进行区分。这样的问题有以下几个经常会用到的地方:(1)点击UIScrollView上的图片,跳转到其他页面;同时不影响UIScrollView的滑动操作。(2)在阅读浏览类产品会经常用到,点击屏幕的中间区域,隐藏/显示状态栏或导航条;同时不影响UIScrollView的滑动翻页操作。 有解决方法事在点击区域添加一个透明的B 阅读全文
posted @ 2012-02-20 17:36 pengyingh 阅读(870) 评论(0) 推荐(0)
摘要: UIScrollView的经典例子就是safari的编辑模式了UIScrollView可以垂直,水平滚动。如果属性pageEnabled = YES,则设置其为分页模式,那么没滚动一次就是一页,垂直方向上的一页就是UIScrollView的高度,水平方向就是其宽度。我们可以设置contentSize,这就是UIScrollView可以滚动的最大区域了。UIScrollView没有datasource的概念,因为这就是一个view,具体view中的内容摆放完全随意,只是每次都会滚动固定的页面大小。比如我们有5个页面,我们需要自己计算每个页面的位置,将其水平放在UIScrollView上。cont 阅读全文
posted @ 2012-02-20 17:35 pengyingh 阅读(230) 评论(0) 推荐(0)
上一页 1 ··· 83 84 85 86 87 88 89 90 91 ··· 125 下一页

导航