iOS应用程序开发(图片处理器)

续上篇 iOS 编程开发图片浏览器,继续实现一个图标生成功能。

功能。

操作系统平台:MacBook(macOS)

IDE:xcode

编程语言:Objective-c

以下是小程序在 iPhone 模拟器中的运行视频。也可以在 iPad 模拟器中运行。

效果图如下所示:

现在有一个方形小图标和圆形小图标。

一:生成遮罩并移动到目标位置

iOS应用程序开发,iPhone模拟器运行效果

新建一个 UIView 控件,调整大小,透明度。再添加移动功能。

self.view3=[[UIView alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];

self.view2 addSubview:self.view3\]; self.view3.backgroundColor=\[UIColor blueColor\]; self.view3.alpha=0.5;

二:改变遮罩颜色

iOS应用程序开发,在iPhone模拟器中运行效果视频。

遮罩颜色改变,用的是 UISegmentedControl 控件。

-(void) pick:(id)sender{

switch(self.segment.selectedSegmentIndex){

case 0:

self.segment setTintColor:\[UIColor redColor\]\]; self.view3.backgroundColor=\[UIColor redColor\]; break; case 1: \[self.segment setTintColor:\[UIColor orangeColor\]\]; self.view3.backgroundColor=\[UIColor orangeColor\]; break; case 2: \[self.segment setTintColor:\[UIColor yellowColor\]\]; self.view3.backgroundColor=\[UIColor yellowColor\]; break; case 3: \[self.segment setTintColor:\[UIColor greenColor\]\]; self.view3.backgroundColor=\[UIColor greenColor\]; break; case 4: \[self.segment setTintColor:\[UIColor cyanColor\]\]; self.view3.backgroundColor=\[UIColor cyanColor\]; break; case 5: \[self.segment setTintColor:\[UIColor blueColor\]\]; self.view3.backgroundColor=\[UIColor blueColor\]; break; case 6: \[self.segment setTintColor:\[UIColor purpleColor\]\]; self.view3.backgroundColor=\[UIColor purpleColor\]; break; }

三:截图生成图标

iOS编程开发,图片处理器在iPhone模拟器上运行效果。

添加一个 UIButton 按钮控件。自动生成图标。

以上内容仅供参考,如有不对,欢迎指正。

首次编辑:2025/03/14 10:08

相关推荐
HarderCoder16 小时前
iOS 知识积累第一弹:从 struct 到 APP 生命周期的全景复盘
ios
goodSleep20 小时前
更新Mac OS Tahoe26用命令恢复 Mac 启动台时不小心禁用了聚焦搜索
macos
叽哥1 天前
Flutter Riverpod上手指南
android·flutter·ios
大熊猫侯佩2 天前
桃花岛 Xcode 构建秘籍:Swift 中的 “Feature Flags” 心法
app·xcode·swift
悄然林静2 天前
Mac终端执行`brew doctor`报`openssl@1.1`警告
mac·xcode·apple
用户092 天前
SwiftUI Charts 函数绘图完全指南
ios·swiftui·swift
YungFan2 天前
iOS26适配指南之UIColor
ios·swift
权咚3 天前
阿权的开发经验小集
git·ios·xcode
用户093 天前
TipKit与CloudKit同步完全指南
ios·swift
小溪彼岸3 天前
macOS自带截图命令ScreenCapture
macos