iOS-畫陰影

    CGContextRef currentContext = UIGraphicsGetCurrentContext();//獲取圖形上下文狀態
    CGContextSaveGState(currentContext);// 將當前圖形上下文狀態保存至堆棧
    CGContextSetShadow(currentContext, CGSizeMake(4,50), 10);// 設置陰影
    UIImage *logoImage = [UIImage imageNamed:@"icon-10_blue.png"];
    [logoImage drawInRect:rect];
    CGContextRestoreGState(currentContext);// 把堆棧頂部項彈出,返回至以前的圖形狀態

 

相關文章
相關標籤/搜索