当前位置:网站首页>[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];
边栏推荐
- SAP ui5 date type sap ui. model. type. Analysis of the parsing format of date
- LeetCode41——First Missing Positive——hashing in place & swap
- LeetCode:236. The nearest common ancestor of binary tree
- Intel distiller Toolkit - Quantitative implementation 1
- Post training quantification of bminf
- 甘肃旅游产品预订增四倍:“绿马”走红,甘肃博物馆周边民宿一房难求
- Intel Distiller工具包-量化实现1
- Tcp/ip protocol
- LeetCode:394. 字符串解码
- Intel distiller Toolkit - Quantitative implementation 2
猜你喜欢

UML diagram memory skills

MySQL uninstallation and installation methods

CUDA implementation of self defined convolution attention operator

Improved deep embedded clustering with local structure preservation (Idec)

Nacos 的安装与服务的注册

Delay initialization and sealing classes

Promise 在uniapp的简单使用

Compétences en mémoire des graphiques UML

LeetCode:236. 二叉树的最近公共祖先

Mise en œuvre de la quantification post - formation du bminf
随机推荐
Revit secondary development Hof method calls transaction
Digital people anchor 618 sign language with goods, convenient for 27.8 million people with hearing impairment
LeetCode:214. Shortest palindrome string
Niuke winter vacation training 6 maze 2
After reading the programmer's story, I can't help covering my chest...
LeetCode:剑指 Offer 48. 最长不含重复字符的子字符串
LeetCode:26. Remove duplicates from an ordered array
LeetCode:124. 二叉树中的最大路径和
LeetCode:214. 最短回文串
LeetCode:剑指 Offer 04. 二维数组中的查找
如何有效地进行自动化测试?
Alibaba cloud server mining virus solution (practiced)
Super efficient! The secret of swagger Yapi
广州推进儿童友好城市建设,将探索学校周边200米设安全区域
Intel Distiller工具包-量化实现2
什么是MySQL?MySql的学习之路是怎样的
Cesium draw points, lines, and faces
注意力机制的一种卷积替代方式
Warning in install. packages : package ‘RGtk2’ is not available for this version of R
vb. Net changes with the window, scales the size of the control and maintains its relative position