139 lines
2.8 KiB
Markdown
139 lines
2.8 KiB
Markdown
![[Pasted image 20240929133515.png]]
|
||
|
||
![[Pasted image 20240929134518.png]]
|
||
|
||
![[Pasted image 20240929134534.png]]
|
||
|
||
![[Pasted image 20240929134611.png]]
|
||
|
||
![[Pasted image 20240929134637.png]]
|
||
|
||
![[Pasted image 20240929174119.png]]
|
||
|
||
![[Pasted image 20240929174418.png]]
|
||
|
||
![[Pasted image 20240929174435.png]]
|
||
|
||
可以拖拽使用,ui组件
|
||
|
||
![[Pasted image 20240929174539.png]]
|
||
|
||
![[Pasted image 20240929175536.png]]
|
||
|
||
![[Pasted image 20240929181737.png]]
|
||
|
||
效果
|
||
|
||
![[Pasted image 20240929181759.png]]
|
||
|
||
拖曳后的配置
|
||
|
||
![[Pasted image 20240929181847.png]]
|
||
|
||
需要注意的是,上述拖曳的操作,是在oc的.h头文件里面,进行的声明操作
|
||
|
||
![[Pasted image 20240929182019.png]]
|
||
|
||
在.m可执行文件中,也随之生成了,按钮点击,相关接口
|
||
|
||
![[Pasted image 20240929182116.png]]
|
||
|
||
写一个helloworld的窗体逻辑
|
||
|
||
![[Pasted image 20240929182218.png]]
|
||
|
||
运行后的,点击效果
|
||
|
||
![[Pasted image 20240929182259.png]]
|
||
|
||
![[Pasted image 20240929182343.png]]
|
||
|
||
xcode工程,文件结构
|
||
|
||
![[Pasted image 20240929182408.png]]
|
||
|
||
![[Pasted image 20240929182759.png]]
|
||
|
||
![[Pasted image 20240929182818.png]]
|
||
|
||
![[Pasted image 20240930094450.png]]
|
||
|
||
视图的创建,有不同的方法
|
||
|
||
![[Pasted image 20240930095110.png]]
|
||
|
||
手动创建的方式
|
||
|
||
![[Pasted image 20240930095350.png]]
|
||
|
||
![[Pasted image 20240930100134.png]]
|
||
|
||
颜色设置相关
|
||
|
||
![[Pasted image 20240930101228.png]]
|
||
|
||
测试效果
|
||
|
||
![[Pasted image 20240930101252.png]]
|
||
|
||
第二种方式,通过代码创建
|
||
|
||
![[Pasted image 20240930101311.png]]
|
||
|
||
在.m可执行文件,写view界面相关,就可以正常创建了,左上角运行,效果正常
|
||
|
||
![[Pasted image 20240930101348.png]]
|
||
|
||
![[Pasted image 20240930101550.png]]
|
||
|
||
![[Pasted image 20240930101615.png]]
|
||
|
||
![[Pasted image 20240930101630.png]]
|
||
|
||
![[Pasted image 20240930101713.png]]
|
||
|
||
![[Pasted image 20240930101733.png]]
|
||
|
||
![[Pasted image 20240930101753.png]]
|
||
|
||
上述介绍了,创建按钮的相关逻辑;
|
||
基于按钮的相关逻辑,创建一个警告视图的弹窗
|
||
|
||
![[Pasted image 20240930101844.png]]
|
||
|
||
run运行,点击按钮,警告弹窗,显示正常
|
||
|
||
![[Pasted image 20240930103246.png]]
|
||
|
||
多项警告
|
||
|
||
![[Pasted image 20240930103337.png]]
|
||
|
||
写逻辑,等待编译完成
|
||
|
||
![[Pasted image 20240930103415.png]]
|
||
|
||
运行,多选项点击,正常
|
||
|
||
![[Pasted image 20240930103446.png]]
|
||
|
||
创建一个UILabel控件,再在.h头文件中,声明变量;
|
||
然后按住Control键,同时拖曳过去,就可以完成绑定;
|
||
|
||
![[Pasted image 20240930103716.png]]
|
||
|
||
然后,删掉Label里面的文本内容
|
||
|
||
![[Pasted image 20240930103932.png]]
|
||
|
||
在.m可执行文件中,也写好按钮点击,和警告框和label的文本显示逻辑
|
||
|
||
![[Pasted image 20240930103903.png]]
|
||
|
||
运行,选中某个按钮
|
||
|
||
![[Pasted image 20240930104046.png]]
|
||
|
||
label文本显示,正常
|
||
|
||
![[Pasted image 20240930104106.png]] |