当前位置:网站首页>两种颜色渐变
两种颜色渐变
2022-04-22 23:52:00 【~废弃回忆 �༄】
@implementation UIColor (****)
/** * @brief 渐变颜色 * * @param c1 开始颜色 * @param c2 结束颜色 * @param height 渐变高度 * * @return 渐变颜色 */
+ (UIColor*)df_jianBianFromColor:(UIColor*)c1 toColor:(UIColor*)c2 withHeight:(int)height
{
CGSize size = CGSizeMake(1, height);
UIGraphicsBeginImageContextWithOptions(size, NO, 0);
CGContextRef context = UIGraphicsGetCurrentContext();
CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB();
NSArray* colors = [NSArray arrayWithObjects:(id)c1.CGColor, (id)c2.CGColor, nil];
CGGradientRef gradient = CGGradientCreateWithColors(colorspace, (__bridge CFArrayRef)colors, NULL);
CGContextDrawLinearGradient(context, gradient, CGPointMake(0, 0), CGPointMake(0, size.height), 0);
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
CGGradientRelease(gradient);
CGColorSpaceRelease(colorspace);
UIGraphicsEndImageContext();
return [UIColor colorWithPatternImage:image];
}
@end
版权声明
本文为[~废弃回忆 �༄]所创,转载请带上原文链接,感谢
https://blog.csdn.net/eastWind1101/article/details/117434673
边栏推荐
- [* ctf2022] Web Topic reproduction and WP
- FPGA (VI) RTL code II (complex circuit design 1)
- Install the most complete version of ActiveMQ under the official website in 2022 and the official website access method
- Install vs2017 plug-in glsl language integration V0 under Windows 7 10.120. Vsix reported an error: Microsoft visualc. redist. twelve
- grid_map(6):grid-mapping-in-ROS编译运行
- 51 single chip microcomputer learning_ 4-1 nixie tube display
- Project training - Kid zombie
- Mung bean sprouts on the 22nd day of home
- Wechat applet page Jump
- 合并两个有序的数组
猜你喜欢

Django指定数据库的时候报No module named ‘django_test.settings‘

闭包的实现原理和作用、以及内存泄露

Magic weapon for easy working time: log in to the server by means of key verification

Write a Tetris game in C language
![[dvcon2020] acceleration of low power design level verification based on signoff abstract model](/img/c1/3495627bf41f5ba8b06d624831e6d8.png)
[dvcon2020] acceleration of low power design level verification based on signoff abstract model

LabVIEW控制电脑关机、休眠、注销和重启

FPGA(六)RTL代码之二(复杂电路设计1)

"100 million" little technical feelings

On LD_ Preload hijacking

unbuntu18.04 安装 gamit10.71 problem solution
随机推荐
[transaction management]
Failed to execute goal on project xxxxx
[experience sharing] share mangopapa's paper learning experience
[turtle confession collection] "the moon at the bottom of the sea is the moon in the sky, and the person in front of us is the sweetheart." More joy and peace for the rest of your life ~ (with 3 sourc
STM32F103 independent watchdog
[note] PCIe ltssm status transition
stm32f103 独立看门狗
[pyGame] can the little dinosaur on chrome be played with code? It looks like fun~
The implementation principle and function of closure and memory leakage
51 单片机学习_4-2 数码管动态显示
[newcoder] week 20220422
80386 compilation_ Introduction to global description table GDT
FileNotFoundError: [Errno 2] No such file or directory: 'image/1.jpg'问题解决
[leetcode] binary tree, 654 largest binary tree, 105 constructs binary tree according to preorder and inorder traversal, 106 constructs binary tree according to inorder and postorder traversal, and 88
[PCIe 6.0] new features of PCIe 6.0 - detailed explanation of l0p
Vs write assembly
[dvcon2020] simulation acceleration method based on multithreaded UVM test platform
【Objective-C 高级编程】—— GCD
【newcoder】20220422周赛
彻底解决Failed to execute goal on project xxxxx