这个项目用到leanCloud,用于加速,需要登录leanCloud,注册、登录 以及忘记密码三个模块,leanCloud返回值的信息不是Json以及XML,所以无法简单的解析,所以封装了2个类,用已提示!比UIAleart好用,返回结果复杂的时候可以借鉴使用~
.h
import <UIKit/UIKit.h>
#define kTipsFontSize 13
#define kMaxFloat [[UIApplication sharedApplication] keyWindow].frame.size.height - 32
/** @prama 自动消失的tips
* @prama 继承与cclabel类 (需完善)
* @prama
*/
@interface CNTipsView : UILabel
/** @prama 初始化方法
* @prama msg:文本
* @return 返回值为CNTipsView对象
*/
- (instancetype)initWithTipMsg:(NSString *)msg;
/** @prama 显示
* @prama 调用此方法, 在keyWindow显示此label
* @return 一段时间后消失并移除本身
*/
- (void)show;
/** @prama 显示的文字
* @prama 具有getter和setter方法
* @return (继续需要完善)
*/
@property (nonatomic , retain) NSString *msgString;
@end
.文件#import "CNTipsView.h"
#import "CNHelper.h"
@implementation CNTipsView
@synthesize msgString;
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
//- (void)drawRect:(CGRect)rect {
// // Drawing code
//
//}
- (void)onAnimationComplete:(NSString *)name finished:(float)time context:(id)data
{
[self removeFromSuperview];
}
- (void)show
{
if (!self.msgString) {
self.msgString = @"错误";