在很多项目中,经常要进行网络请求操作而为了更好的用户体验和美观,我们需要定制开发网络加载控件,下面是自定义网络加载控件实现方式:
头文件UIView+WHC_Loading.h实现:
//
// UIView+WHC_Loading.h
// UIView+WHC_Loading
//
// Created by 吴海超 on 15/3/25.
// Copyright (c) 2015年 吴海超. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIView (WHC_Loading)
- (void)startLoading;
- (void)stopLoading;
- (void)startLoadingWithTxt:(NSString*)customTitle;
- (void)stopLoadingWithTxt;
- (void)startLoadingWithTxtUser:(NSString*)customTitle;
- (void)stopLoadingWithTxtUser;
- (void)startLoadingWithUser;
- (void)stopLoadingWithUser;
@end
源文件UIView+WHC_Loading.m实现方式:
//
// UIView+WHC_Loading.m
// UIView+WHC_Loading
//
// Created by 吴海超 on 15/3/25.
// Copyright (c) 2015年 吴海超. All rights reserved.
//
#import "UIView+WHC_Loading.h"
#define KWHC_LOADING_VIEW_SIZE (50.0) //显示不带提示文字view的尺寸
#define KWHC_FONT_SIZE (15.0) //默认字体大小