http://blog.sina.com.cn/gameloft[订阅]
个人资料
访客
读取中...
评论
读取中...
友情链接
NibiruTech

中国第一的ruby on rails公司

智酷游戏

著名的智库游戏

好友
读取中...
博文
 void (*setter)(id, SEL, BOOL); 
 int i; 
   

 setter = (void (*)(id, SEL, BOOL))[target 
     methodForSelector:@selector(setFilled:)]; 
 for ( i = 0; i < 1000, i++ ) 
     setter(targetList[i], @selector(setFilled:), YES); 
multi touch event 例子(2009-02-06 10:17)
#pragma mark -- mask image's gesture --

#define DRAG_MIN 8
- (UIView*)webDocumentView
{
    NSArray *array = [[[webView subviews] objectAtIndex:0] subviews];
    for(UIView *v in array)
    {
        if([v respondsToSelector:@selector(loadRequest:)])
            return v;
    }

    return nil;
}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    if([touches count] > 1)
    {
        touchA = [[touches allObjects] objectAtIndex:0];
        touchB = [[touches allObjects] objectAtIndex:1];
    }
    else
    {
        if(!touchA)
            touchA = [[touches allObjects] objectAtIndex:0];
        else
            touchB = [[touches allObjects] objectAtIndex:0];
    }
    if(!touchB)
        [[self webDocumentView] touchesBegan:touches withEvent:event];
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    if(touchA && touchB)
    {
        CGPoint prevA = [touchA previousLocationInView:maskView];
        CGPoint currA = [touchA locationInView:maskView];
        CGPoint prevB = [touchB previousLocationInView:maskView];
        CGPoint currB = [touchB locationInView:maskView];

        int lvl = [[webView stringByEvaluatingJavaScriptFromString:@'map.getZoom()'] intValue];
        NSString *errMsg = nil;
        if(fabs(currB.x - currA.x) + fabs(currB.y - currA.y) > fabs(prevB.x - prevA.x) + fabs(prevB.y - prevA.y))
        {
            [webView stringByEvaluatingJavaScriptFromString:@'map.zoomIn();'];
            if([[webView stringByEvaluatingJavaScriptFromString:@'map.getZoom()'] intValue] == lvl)
                errMsg = @'can no longer zoom in';
        }
        else
        {
            [webView stringByEvaluatingJavaScriptFromString:@'map.zoomOut();'];
            if([[webView stringByEvaluatingJavaScriptFromString:@'map.getZoom()'] intValue] == lvl)
                errMsg = @'can no longer zoom out';
        }
        if(errMsg)
        {
            UIAlertView *v = [[UIAlertView alloc] initWithTitle:@'Hotel'
                                                        message:errMsg
                                                       delegate:nil
                                              cancelButtonTitle:@'dissmiss'
                                              otherButtonTitles:nil];
            [v show];
            [v release];            
        }
    }
    else
        [[self webDocumentView] touchesEnded:touches withEvent:event];

    for(UITouch *touch in touches)
    {
        if(touch == touchA)
            touchA = nil;
        else if(touch == touchB)
            touchB = nil;
    }
}

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    if(!touchB)
        [[self webDocumentView] touchesMoved:touches withEvent:event];
}

- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
    if(!touchB)
        [[self webDocumentView] touchesCancelled:touches withEvent:event];
}

我连续两次,在不同时间,不同地点,发生两次车祸。责任在我,我赔偿了500员。
伤钱之余,我不仅担心起来,怕自己伤害到行人。。。

这两天,我开车,非常慢,非常慢。最慢20码,最快只开到60码,内心颇为谨慎。
心里惦念起龙马人来了. 不知道他的企业做得怎么样了...
什么时候我有时间了,一定去看看他去.
我不是个孝子(2008-12-29 22:01)
很久没去看望父母了,惦记他们。可是最近工作很累,一到周末,我只想休息,也许父母可以理解我吧?可是我不能原谅自己,因为我还是会去打球,会拉着老婆去看电影,就是没去看望父母,我不是个孝子...
留下了莫名的感伤。我什么也没有说,我对他一句话也没有讲。昨天还是好兄弟,一句辞职,仿佛成了陌路。。。我心里祝他能过的很好,但是嘴上,已经无话可说。我是有辞职经验的人,辞职之后,是有留恋的,不知道joey内心是否也是有留恋。
Joey走了(2008-12-08 23:35)
留下了莫名的感伤。我什么也没有说,我对他一句话也没有讲。昨天还是好兄弟,一句辞职,仿佛成了陌路。。。我心里祝他能过的很好,但是嘴上,已经无话可说。我是有辞职经验的人,辞职之后,是有留恋的,不知道joey内心是否也是有留恋。
UIWebView's touch event(2008-09-30 09:40)
UIWebView is a blackhole for touch events. I haven't found a perfect way of doing it yet.