134 lines
2.8 KiB
Markdown
134 lines
2.8 KiB
Markdown
![]() |
![[Pasted image 20240930105532.png]]
|
|||
|
|
|||
|
![[Pasted image 20240930110507.png]]
|
|||
|
|
|||
|
![[Pasted image 20240930110624.png]]
|
|||
|
|
|||
|
继续,创建按钮点击逻辑,创建UIActionSheet
|
|||
|
|
|||
|
![[Pasted image 20240930110657.png]]
|
|||
|
|
|||
|
运行效果正常
|
|||
|
|
|||
|
![[Pasted image 20240930110721.png]]
|
|||
|
|
|||
|
继续,是UIActionSheet按钮,点击的相关逻辑
|
|||
|
|
|||
|
![[Pasted image 20240930133818.png]]
|
|||
|
|
|||
|
在警告弹窗出来后,点击,对应响应也是正常的
|
|||
|
|
|||
|
![[Pasted image 20240930143713.png]]
|
|||
|
|
|||
|
![[Pasted image 20240930143646.png]]
|
|||
|
|
|||
|
![[Pasted image 20240930144020.png]]
|
|||
|
|
|||
|
对应的分段控件
|
|||
|
|
|||
|
![[Pasted image 20240930144109.png]]
|
|||
|
|
|||
|
表现
|
|||
|
|
|||
|
![[Pasted image 20240930144416.png]]
|
|||
|
|
|||
|
再拖曳一个View界面类
|
|||
|
|
|||
|
![[Pasted image 20241009093103.png]]
|
|||
|
|
|||
|
设置背景颜色
|
|||
|
|
|||
|
![[Pasted image 20241009093158.png]]
|
|||
|
|
|||
|
上述设置背景颜色,为红色;
|
|||
|
再拖曳一个view组件到右边,设置背景为绿色;
|
|||
|
|
|||
|
![[Pasted image 20241009093509.png]]
|
|||
|
|
|||
|
再弄一个label文本
|
|||
|
|
|||
|
![[Pasted image 20241009093648.png]]
|
|||
|
|
|||
|
右侧也弄一个,其上对应的文本
|
|||
|
|
|||
|
![[Pasted image 20241009093801.png]]
|
|||
|
|
|||
|
点击,切换到代码逻辑
|
|||
|
|
|||
|
![[Pasted image 20241009093956.png]]
|
|||
|
|
|||
|
先手动,声明仨变量
|
|||
|
|
|||
|
![[Pasted image 20241009094208.png]]
|
|||
|
|
|||
|
支持直接拖拽过去,绑定
|
|||
|
|
|||
|
![[Pasted image 20241009094227.png]]
|
|||
|
|
|||
|
其余俩,也是同理
|
|||
|
|
|||
|
![[Pasted image 20241009094924.png]]
|
|||
|
|
|||
|
拖曳,可堆叠
|
|||
|
|
|||
|
![[Pasted image 20241009095139.png]]
|
|||
|
|
|||
|
.h头文件当前结构
|
|||
|
|
|||
|
![[Pasted image 20241009101858.png]]
|
|||
|
|
|||
|
.m可执行文件,修改对应ui的相关逻辑
|
|||
|
|
|||
|
![[Pasted image 20241009103203.png]]
|
|||
|
|
|||
|
运行,上方 segmentedControl点击,控制下方view切换
|
|||
|
|
|||
|
![[Pasted image 20241009103517.png]]
|
|||
|
|
|||
|
![[Pasted image 20241009103622.png]]
|
|||
|
|
|||
|
创建第一个xib
|
|||
|
|
|||
|
![[Pasted image 20241009103648.png]]
|
|||
|
|
|||
|
![[Pasted image 20241009103807.png]]
|
|||
|
|
|||
|
![[Pasted image 20241009103822.png]]
|
|||
|
|
|||
|
区分俩xib,先设置第一个xib的背景为,纯红,再加一个button按钮;
|
|||
|
第二个的背景为,纯黄,也加一个不同文本的button按钮;
|
|||
|
|
|||
|
![[Pasted image 20241009103919.png]]
|
|||
|
|
|||
|
![[Pasted image 20241009103950.png]]
|
|||
|
|
|||
|
xib切换到编辑模式,直接拖拽过去
|
|||
|
|
|||
|
![[Pasted image 20241009104052.png]]
|
|||
|
|
|||
|
自动生成的代码接口
|
|||
|
|
|||
|
![[Pasted image 20241009104156.png]]
|
|||
|
|
|||
|
.m也自动生成按钮点击sender接口;
|
|||
|
import引用`SecondViewController.h` 头文件,再在sender接口,写具体逻辑,把SecondViewController的view界面,作为当前view的子视图
|
|||
|
|
|||
|
![[Pasted image 20241009104317.png]]
|
|||
|
|
|||
|
SecondView对应的按钮,也是同理拖曳,设置连接Connection行为Action
|
|||
|
|
|||
|
![[Pasted image 20241009104819.png]]
|
|||
|
|
|||
|
命名为return即可
|
|||
|
|
|||
|
![[Pasted image 20241009104956.png]]
|
|||
|
|
|||
|
.m逻辑中,自动生成的点击逻辑接口,SecondView的按钮点击,直接removeview即可
|
|||
|
|
|||
|
![[Pasted image 20241009105106.png]]
|
|||
|
|
|||
|
运行,切换也是正常
|
|||
|
|
|||
|
![[Pasted image 20241009105215.png]]
|
|||
|
|
|||
|
![[Pasted image 20241009105233.png]]
|