Segue NSTimer 和 Delayed perform
来源:互联网 发布:windows temp文件夹 编辑:程序博客网 时间:2024/06/07 19:05
segue 、 NSTimer 和 Delayed perform 的自我学习
NSTimer : NSObject
+ (NSTimer*)timerWithTimeInterval:(NSTimeInterval)ti invocation:(NSInvocation*)invocation repeats:(BOOL)yesOrNo;
+ (NSTimer*)scheduledTimerWithTimeInterval:(NSTimeInterval)ti invocation:(NSInvocation*)invocation repeats:(BOOL)yesOrNo;
+ (NSTimer*)timerWithTimeInterval:(NSTimeInterval)ti target:(id)aTarget selector:(SEL)aSelector userInfo:(nullableid)userInfo repeats:(BOOL)yesOrNo;
+ (NSTimer*)scheduledTimerWithTimeInterval:(NSTimeInterval)ti target:(id)aTarget selector:(SEL)aSelector userInfo:(nullableid)userInfo repeats:(BOOL)yesOrNo;
UIStoryboardSegue :NSObject
+ (instancetype)segueWithIdentifier:(nullableNSString*)identifier source:(UIViewController*)source destination:(UIViewController*)destination performHandler:(void(^)(void))performHandler;
- (instancetype)initWithIdentifier:(nullableNSString*)identifier source:(UIViewController*)source destination:(UIViewController*)destination ;
- (instancetype)init;
@property(nullable,nonatomic,copy,readonly)NSString*identifier;//标识符
@property(nonatomic,readonly)__kindofUIViewController *sourceViewController;//源控制器
@property(nonatomic,readonly)__kindofUIViewController *destinationViewController;//目的控制器
一个方法,三个属性
一个方法,三个属性
NSTimer : NSObject
+ (NSTimer*)timerWithTimeInterval:(NSTimeInterval)ti invocation:(NSInvocation*)invocation repeats:(BOOL)yesOrNo;
+ (NSTimer*)scheduledTimerWithTimeInterval:(NSTimeInterval)ti invocation:(NSInvocation*)invocation repeats:(BOOL)yesOrNo;
+ (NSTimer*)timerWithTimeInterval:(NSTimeInterval)ti target:(id)aTarget selector:(SEL)aSelector userInfo:(nullableid)userInfo repeats:(BOOL)yesOrNo;
+ (NSTimer*)scheduledTimerWithTimeInterval:(NSTimeInterval)ti target:(id)aTarget selector:(SEL)aSelector userInfo:(nullableid)userInfo repeats:(BOOL)yesOrNo;
- (instancetype)initWithFireDate:(NSDate*)date interval:(NSTimeInterval)ti target:(id)t selector:(SEL)s userInfo:(nullableid)ui repeats:(BOOL)rep;
- (void)fire; 定时器开始
- (void)invalidate; 定时器 结束
@property(copy)NSDate*fireDate;
@property(readonly)NSTimeIntervaltimeInterval;
@propertyNSTimeIntervaltolerance;
@property(readonly,getter=isValid)BOOLvalid;
@property(nullable,readonly,retain)iduserInfo;
@property(nullable,readonly,retain)iduserInfo;
scheduledTimerWithTimeInterval:(NSTimeInterval)seconds
预订一个Timer,设置一个时间间隔。
表示输入一个时间间隔对象,以秒为单位,一个>0的浮点类型的值,如果该值<0,系统会默认为0.1
target:(id)aTarget
表示发送的对象,如self
selector:(SEL)aSelector
方法选择器,在时间间隔内,选择调用一个实例方法
userInfo:(id)userInfo
此参数可以为nil,当定时器失效时,由你指定的对象保留和释放该定时器。
repeats:(BOOL)yesOrNo
当YES时,定时器会不断循环直至失效或被释放,当NO时,定时器会循环发送一次就失效。
invocation:(NSInvocation *)invocation
sche
#不用scheduled方式初始化的,需要手动addTimer:forMode: 将timer添加到一个runloop中。
而scheduled的初始化方法将以默认mode直接添加到当前的runloop中.
Delayed perform 延迟执行
NSObject (NSDelayedPerforming)
- (void)performSelector:(SEL)aSelector withObject:(nullableid)anArgument afterDelay:(NSTimeInterval)delay inModes:(NSArray<NSString*> *)modes;
- (void)performSelector:(SEL)aSelector withObject:(nullableid)anArgument afterDelay:(NSTimeInterval)delay; 最常用
+ (void)cancelPreviousPerformRequestsWithTarget:(id)aTarget selector:(SEL)aSelector object:(nullableid)anArgument;
- (void)performSelector:(SEL)aSelector withObject:(nullableid)anArgument afterDelay:(NSTimeInterval)delay; 最常用
+ (void)cancelPreviousPerformRequestsWithTarget:(id)aTarget selector:(SEL)aSelector object:(nullableid)anArgument;
+ (void)cancelPreviousPerformRequestsWithTarget:(id)aTarget;
NSRunLoop (NSOrderedPerform)
- (void)performSelector:(SEL)aSelector target:(id)target argument:(nullableid)arg order:(NSUInteger)order modes:(NSArray<NSString*> *)modes;
- (void)cancelPerformSelector:(SEL)aSelector target:(id)target argument:(nullableid)arg;
- (void)cancelPerformSelector:(SEL)aSelector target:(id)target argument:(nullableid)arg;
- (void)cancelPerformSelectorsWithTarget:(id)target;
提示框的弹出和自动取消
if([nameisEqualToString:@""] || [phoneNum isEqualToString:@""] ) {
UIAlertController *alert = [UIAlertControlleralertControllerWithTitle:@"提示"message:@"姓名或手机号为空"preferredStyle:UIAlertControllerStyleAlert];
[selfpresentViewController:alertanimated:YEScompletion:nil];
UIAlertController *alert = [UIAlertControlleralertControllerWithTitle:@"提示"message:@"姓名或手机号为空"preferredStyle:UIAlertControllerStyleAlert];
[selfpresentViewController:alertanimated:YEScompletion:nil];
[selfperformSelector:@selector(dismissViewControllerAnimated:completion:)withObject:nilafterDelay:2.0];
0 0
- Segue NSTimer 和 Delayed perform
- swift4.0 perform segue跳转详解
- Delayed ACK 和 nagle算法
- SEGUE
- Segue
- mysql delayed 延迟插入和参数DELAY_KEY_WRITE
- iOS自定义segue和自定义segue转场动画
- 通讯录之手动型Segue和自动型Segue
- IOS-笔记15(Unwind Segue,Action Sheets,Alert,NSTimer)
- 键盘事件和NSTimer
- NSThread 和 NSTimer
- 动画和NSTimer
- NSTimer和NSNotification小结
- NSRunLoop和nstimer
- NSTimer使用和细节
- CADisplayLink 和 NSTimer
- NSRunloop 和 NSTimer
- ScrollView代理和NSTimer
- java Date(int year,int month,int date)需要注意
- hdu 1046 Gridland
- popen函数相关
- Bootstrap table的一些简单使用总结
- bzoj2005 能量采集 数论
- Segue NSTimer 和 Delayed perform
- Mac Eclipse JAVAHL问题
- leetcodeBulls and Cows
- 在ubuntu中安装eclipse for c++
- 你的能力是更适合做微商还是淘宝
- LA 4329 树状数组入门
- 排序算法的种类
- UML之C++类间关系总结
- POJ 3737 UmBasketella (求最大体积圆锥)