-
-
Save Huang-Libo/8296143f2c594a87b5b27ec7230b2191 to your computer and use it in GitHub Desktop.
YTKAnimatingRequestAccessory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// YTKAnimatingRequestAccessory.h | |
// Ape_uni | |
// | |
// Created by Chenyu Lan on 10/30/14. | |
// Copyright (c) 2014 Fenbi. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
#import <YTKBaseRequest.h> | |
@interface YTKAnimatingRequestAccessory : NSObject <YTKRequestAccessory> | |
@property(nonatomic, weak) UIView *animatingView; | |
@property(nonatomic, strong) NSString *animatingText; | |
- (id)initWithAnimatingView:(UIView *)animatingView; | |
- (id)initWithAnimatingView:(UIView *)animatingView animatingText:(NSString *)animatingText; | |
+ (id)accessoryWithAnimatingView:(UIView *)animatingView; | |
+ (id)accessoryWithAnimatingView:(UIView *)animatingView animatingText:(NSString *)animatingText; | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// YTKAnimatingRequestAccessory.m | |
// Ape_uni | |
// | |
// Created by Chenyu Lan on 10/30/14. | |
// Copyright (c) 2014 Fenbi. All rights reserved. | |
// | |
#import "YTKAnimatingRequestAccessory.h" | |
#import "YTKAlertUtils.h" | |
@implementation YTKAnimatingRequestAccessory | |
- (id)initWithAnimatingView:(UIView *)animatingView animatingText:(NSString *)animatingText { | |
self = [super init]; | |
if (self) { | |
_animatingView = animatingView; | |
_animatingText = animatingText; | |
} | |
return self; | |
} | |
- (id)initWithAnimatingView:(UIView *)animatingView { | |
self = [super init]; | |
if (self) { | |
_animatingView = animatingView; | |
} | |
return self; | |
} | |
+ (id)accessoryWithAnimatingView:(UIView *)animatingView { | |
return [[self alloc] initWithAnimatingView:animatingView]; | |
} | |
+ (id)accessoryWithAnimatingView:(UIView *)animatingView animatingText:(NSString *)animatingText { | |
return [[self alloc] initWithAnimatingView:animatingView animatingText:animatingText]; | |
} | |
- (void)requestWillStart:(id)request { | |
if (_animatingView) { | |
[YTKAlertUtils showLoadingAlertView:_animatingText inView:_animatingView]; | |
} | |
} | |
- (void)requestWillStop:(id)request { | |
if (_animatingView) { | |
[YTKAlertUtils hideLoadingAlertView:_animatingView]; | |
} | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment