小编Ale*_*lec的帖子

iPhone SDK从屏幕上删除UIImageView使用触摸?

我正在寻找一种能够从屏幕上擦除UIImageView的方法.当我说擦除时我并不是说[imageView removeFromSuperview];,我的意思是通过在屏幕上涂抹手指来擦除部分图像.无论你的手指在哪里,都是被删除的图像部分.我只是找不到任何帮助.

我想成像与Quartz有关吗?如果是这样的话,我对此并不是很好.:(

我想最好的例子是彩票.一旦你抓住机票的一部分,它下面的那个区域就会显露出来.有谁知道怎么做到这一点?

谢谢!

更新:

以下代码是诀窍.谢谢!

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    UITouch *touch = [touches anyObject];
    lastTouch = [touch locationInView:canvasView];
}

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
    UITouch *touch = [touches anyObject];
    currentTouch = [touch locationInView:canvasView];

    CGFloat brushSize = 35;
    CGColorRef strokeColor = [UIColor whiteColor].CGColor;

    UIGraphicsBeginImageContext(scratchView.frame.size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    [canvasView.image drawInRect:CGRectMake(0, 0, canvasView.frame.size.width, canvasView.frame.size.height)];
    CGContextSetLineCap(context, kCGLineCapRound);
    CGContextSetLineWidth(context, brushSize);
    CGContextSetStrokeColorWithColor(context, strokeColor);
    CGContextSetBlendMode(context, kCGBlendModeClear);
    CGContextBeginPath(context);
    CGContextMoveToPoint(context, lastTouch.x, lastTouch.y);
    CGContextAddLineToPoint(context, currentTouch.x, currentTouch.y);
    CGContextStrokePath(context);
    canvasView.image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    lastTouch …
Run Code Online (Sandbox Code Playgroud)

iphone core-graphics quartz-graphics uitouch ios

10
推荐指数
1
解决办法
1692
查看次数

PHP和MySQL从时间减去秒数

我在桌子上有2点,我想从中减去0:01.我在这之前的一篇文章中尝试过,但没有任何帮助.

在PHP和MySQL中,我如何从2分钟减去1秒?

if (isset($_GET['id']) && isset($_GET['time'])) {
    mysql_select_db("aleckaza_pennyauction", $connection);
    $query = "SELECT Current_Time FROM Live_Auctions WHERE ID='1'";
    $results = mysql_query($query) or die(mysql_error());

    while ($row = mysql_fetch_array($results)) {
        $newTime = $row['Current_Time'];
        $query = "INSERT INTO Live_Auctions(Current_Time) VALUES('".$newTime."')";
        $results = mysql_query($query) or die(mysql_error());
    }
}
Run Code Online (Sandbox Code Playgroud)

谢谢.

php mysql

3
推荐指数
1
解决办法
1446
查看次数

标签 统计

core-graphics ×1

ios ×1

iphone ×1

mysql ×1

php ×1

quartz-graphics ×1

uitouch ×1