当前位置:网站首页>[oc]- < getting started with UI> -- common controls - prompt dialog box and wait for the prompt (circle)
[oc]- < getting started with UI> -- common controls - prompt dialog box and wait for the prompt (circle)
2022-07-06 08:58:00 【About Xiaosi】
List of articles
UIAlertController
UIAlertController yes iOSUI Waiting prompt box control of the interface
Be careful
- stay iOS 9.0 after The previous prompt dialog UIAlertView deprecated
When we play UIAlertView When the object - It also includes some video explanations Xcode The compilation environment of has become iOS 9 following
- stay iOS 9 after Xcode A new UIAlertController Object to create a dialog prompt box object
UIAlertController Usage of
- Create a warning prompt box object
- Develop a method of synthesizing access methods [email protected]
@interface ViewController : UIViewController<UIAlertViewDelegate> {
// Warning box view object
UIAlertController* _alertView ;
// Wait for the prompt object
// Display this control when downloading or loading large files , In the state of waiting for promotion
}
@property(retain, nonatomic) UIAlertController* alertView;
@end
- Synchronize attributes and member variables
@implementation ViewController// Implementation part
@synthesize alertView = _alertView;
// Wait for the prompt box Not here
@synthesize activityIndicator = _activityIndicator;
- Add one more button Use the same event function
Circular creation It can be created separately - The reason why the loop is created is that I put Prompt dialog And Wait for the prompt The two buttons together create
- Button to create another blog UIBUtton The creation of
UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
btn.frame = CGRectMake(100, 100 + 100 * i, 100, 40);
[btn setTitle:@" Warning dialog frame " forState:UIControlStateNormal];
// Because I create loops Set the sign in order to button Reference to the event
btn.tag = 100 + i
- add to button event function
- The reason for taking parameters is that we have more than one button
[btn addTarget:self action:@selector(pressBtn :)
forControlEvents:UIControlEventTouchUpInside];
iOS9.0. above UIAlertController Create method
- 1) iOS 9 After that UIAlertController usage
The topic and content of the prompt :
_alertView = [UIAlertController alertControllerWithTitle:@" Warning "
message:@" My mobile phone was invaded by me , About to shut down , Hit the money quickly "
preferredStyle:UIAlertControllerStyleAlert];
Parameters 1: Warning -- Is the title of our prompt box
Parameters 2: My mobile phone was invaded by me , About to shut down , Hit the money quickly " --- Prompt content
- 2) Add options
- Option one :
UIAlertAction* sure = [UIAlertAction actionWithTitle:@" determine "
style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action)
{
NSLog(@" determine ");
}];
- Option 2 —cancle
UIAlertAction* cancel = [UIAlertAction actionWithTitle:@" Cancel "
style:UIAlertActionStyleCancel handler:nil];
- 3) Add options to the view _alertView
- _alertView Is the prompt box view we created
[_alertView addAction:sure];
[_alertView addAction:cancel];
- Show view
// Show view
[self presentViewController:_alertView animated:YES
completion:nil];
effect
UIActivityIndicatorView
- Wait for the prompt object -- Display this control when downloading or loading large files , In the state of waiting for promotion
// Wait for the prompt object
// Display this control when downloading or loading large files , In the state of waiting for promotion
UIActivityIndicatorView* _activityIndicator;
UIActivityIndicatorView The creation of
- Synthetic access methods
@property(retain, nonatomic) UIActivityIndicatorView* activityIndicator;
- Synchronize attributes and member variables
@synthesize activityIndicator = _activityIndicator;
- establish button
UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
btn.frame = CGRectMake(100, 100 + 100 * i, 100, 40);
[btn setTitle:@" Prompt dialog " forState:UIControlStateNormal];
btn.tag = 100 + i;
[btn addTarget:self action:@selector(pressBtn :) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btn];
- add to button event
- Wait for the indicator wide High is unchangeable
_activityIndicator = [[UIActivityIndicatorView alloc]
initWithFrame:CGRectMake(100, 300, 80, 80)] ;
- Wait for the indicator to turn into what color
self.view .backgroundColor = [UIColor whiteColor];
[self.view addSubview:_activityIndicator];
// Start the animated screen display
[_activityIndicator startAnimating];
effect
- When we click the prompt dialog The circles in the figure will appear
Wait for the deactivation of the dialog box
When we don't need this effect , Enter this line of code to not display the animation
// Stop waiting for dialog
[_activityIndicator stopAnimating];
边栏推荐
- 不同的数据驱动代码执行相同的测试场景
- Warning in install. packages : package ‘RGtk2’ is not available for this version of R
- Implement window blocking on QWidget
- Tcp/ip protocol
- LeetCode41——First Missing Positive——hashing in place & swap
- vb. Net changes with the window, scales the size of the control and maintains its relative position
- pytorch查看张量占用内存大小
- Advanced Computer Network Review(4)——Congestion Control of MPTCP
- [MySQL] limit implements paging
- [text generation] recommended in the collection of papers - Stanford researchers introduce time control methods to make long text generation more smooth
猜你喜欢
Improved deep embedded clustering with local structure preservation (Idec)
数学建模2004B题(输电问题)
一篇文章带你了解-selenium工作原理详解
Variable length parameter
Post training quantification of bminf
注意力机制的一种卷积替代方式
Detailed explanation of dynamic planning
Cesium draw points, lines, and faces
CUDA realizes focal_ loss
BMINF的后训练量化实现
随机推荐
Advanced Computer Network Review(5)——COPE
Revit 二次开发 HOF 方式调用transaction
[MySQL] multi table query
KDD 2022论文合集(持续更新中)
数字人主播618手语带货,便捷2780万名听障人士
LeetCode:34. 在排序数组中查找元素的第一个和最后一个位置
[OC]-<UI入门>--常用控件-提示对话框 And 等待提示器(圈)
Pytest参数化你不知道的一些使用技巧 /你不知道的pytest
[OC-Foundation框架]-<字符串And日期与时间>
Using pkgbuild:: find in R language_ Rtools check whether rtools is available and use sys The which function checks whether make exists, installs it if not, and binds R and rtools with the writelines
Intel Distiller工具包-量化实现3
Tcp/ip protocol
数学建模2004B题(输电问题)
自动化测试框架有什么作用?上海专业第三方软件测试公司安利
UML diagram memory skills
Intel Distiller工具包-量化实现1
Target detection - pytorch uses mobilenet series (V1, V2, V3) to build yolov4 target detection platform
CUDA实现focal_loss
SimCLR:NLP中的对比学习
Revit secondary development Hof method calls transaction