ios CCUIAlertActivityView.m

objectivec 复制代码
//
//  CCUIAlertActivityView.h
//  CCFC
//
//


#import <Foundation/Foundation.h>




@interface CCUIAlertActivityView : UIView
{
        UIAlertView                             *_alertView;
        UIActivityIndicatorView *_activityView;
        
        float                                   _disappearTime;
}


// if set 0, then it won't disappear until you hide it.
@property(nonatomic, assign)    float   disappearTime;


- (id)initWithTitle:(NSString *)title;
- (void)dealloc;


- (void)show;
- (void)hide;


@end
objectivec 复制代码
//
//  CCUIAlertActivityView.m
//  CCFC
//
//


#import "CCUIAlertActivityView.h"
#import "CCNSNumber.h"
#import "CCUIView.h"
#import "CCCommon.h"
#import "CCLog.h"


@implementation CCUIAlertActivityView


@synthesize disappearTime = _disappearTime;


- (id)initWithTitle:(NSString *)title
{
        self = [super init];
        if(self)
        {
                _alertView = [[UIAlertView alloc] initWithTitle:title
                                                                                                message:nil
                                                                                           delegate:self
                                                                          cancelButtonTitle:nil
                                                                          otherButtonTitles:nil];


                _activityView = [[UIActivityIndicatorView alloc] 
                                                 initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
                _activityView.frame = CGRectMake(0, 0, 20, 20);
                [_alertView addSubview:_activityView];
                [_activityView release];
        }
        return self;
}


- (void)dealloc
{
        [super dealloc];
}


- (void)onDisappear:(id)timer PRIVATE_FLAG
{
        [_activityView stopAnimating];
        [_alertView dismissWithClickedButtonIndex:0 animated:YES];
}


- (void)show
{
        [_alertView show];


        [_activityView setCenterOf:_alertView];
        [_activityView startAnimating];
        [_alertView release];
        if(!FLOAT_EQUAL_TO_ZERO(_disappearTime))
        {
                [NSTimer scheduledTimerWithTimeInterval:_disappearTime
                                                                                 target:self
                                                                           selector:@selector(onDisappear:)
                                                                           userInfo:nil
                                                                                repeats:NO];
        }
}


- (void)hide
{
        [_alertView dismissWithClickedButtonIndex:0 animated:YES];
}


@end

微风不燥,阳光正好,你就像风一样经过这里,愿你停留的片刻温暖舒心。

我是程序员小迷(致力于C、C++、Java、Kotlin、Android、Shell、JavaScript、TypeScript、Python等编程技术的技巧经验分享),若作品对您有帮助,请关注、分享、点赞、收藏、在看、喜欢,您的支持是我们为您提供帮助的最大动力。

欢迎关注。助您在编程路上越走越好!

相关推荐
0xAaron3 小时前
确定crash文件和dSYM是否对应
ios·uuid·crash·dsym
0xAaron5 小时前
符号表和 dSYM UUID 确认
ios·cocoa·uuid·符号表·dsym
0xAaron5 小时前
如何使用dSYM文件来符号化崩溃信息
ios·swift·调试·崩溃·符号化·dsym
小蜜蜂嗡嗡5 小时前
【flutter项目从xcode运行时报错:Undefined symbol: _OBJC_CLASS_$_WeiboSDK】
flutter·cocoa·xcode
Sheffi665 小时前
RunLoop 深度探索:线程为什么不会自动退出
macos·objective-c·cocoa
2501_915918417 小时前
Flutter 加固方案全解析,从 Dart 层到 IPA 成品的多工具协同防护体系
flutter·macos·ios·小程序·uni-app·cocoa·iphone
wsxlgg7 小时前
IOS 打包上传提示you do not have required contracts to perform an operation
ios
每周报刊8 小时前
初代 iPhone SE 谢幕:被标为 “过时”,小屏旗舰时代彻底落幕
ios·iphone
RollingPin8 小时前
iOS 动态库与静态库的区别
ios·framework·动态库·静态库·符号表·三方库·dyld
0xAaron8 小时前
ips 文件符号化
ios·swift·调试·ips·符号化