Commit 02a78e8b authored by 曹云霄's avatar 曹云霄

修改项说明:公告开发

parent d2b3a199
...@@ -239,7 +239,7 @@ ...@@ -239,7 +239,7 @@
#pragma mark -开始筛选时间 #pragma mark -开始筛选时间
- (IBAction)StartscreeningButtonClick:(UIButton *)sender { - (IBAction)StartScreeningButtonClick:(UIButton *)sender {
DateSelectedViewController *datevc = [[DateSelectedViewController alloc]init]; DateSelectedViewController *datevc = [[DateSelectedViewController alloc]init];
//选中时间回调 //选中时间回调
...@@ -271,7 +271,7 @@ ...@@ -271,7 +271,7 @@
} }
#pragma mark -结束筛选时间 #pragma mark -结束筛选时间
- (IBAction)EndscreeningButtonClick:(UIButton *)sender { - (IBAction)EndScreeningButtonClick:(UIButton *)sender {
DateSelectedViewController *datevc = [[DateSelectedViewController alloc]init]; DateSelectedViewController *datevc = [[DateSelectedViewController alloc]init];
......
//
// AnnouncementTableViewCell.h
// Lighting
//
// Created by 曹云霄 on 2016/11/23.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AnnouncementTableViewCell : UITableViewCell
/**
公告类型
*/
@property (weak, nonatomic) IBOutlet CustomBorderLabel *announcementTypeLabel;
/**
公告标题
*/
@property (weak, nonatomic) IBOutlet UILabel *announcementTitleLabel;
/**
公告时间
*/
@property (weak, nonatomic) IBOutlet UILabel *announcementTimeLabel;
/**
公告数据
*/
@property (nonatomic,strong) TOAfficheEntity *afficheEntity;
@end
//
// AnnouncementTableViewCell.m
// Lighting
//
// Created by 曹云霄 on 2016/11/23.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "AnnouncementTableViewCell.h"
@implementation AnnouncementTableViewCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setAfficheEntity:(TOAfficheEntity *)afficheEntity
{
_afficheEntity = afficheEntity;
self.announcementTypeLabel.customText = _afficheEntity.afficheType;
self.announcementTimeLabel.text = [NSString stringWithFormat:@"发布时间:%@",_afficheEntity.createDate];
self.announcementTitleLabel.text = _afficheEntity.title;
}
@end
...@@ -10,4 +10,21 @@ ...@@ -10,4 +10,21 @@
@interface AnnouncementViewController : BaseViewController @interface AnnouncementViewController : BaseViewController
/**
筛选条件背景
*/
@property (weak, nonatomic) IBOutlet UIView *chooseBackgroundView;
/**
时间排列<正序、逆序>
*/
@property (weak, nonatomic) IBOutlet UIButton *timeOrderButton;
/**
公告tableView
*/
@property (weak, nonatomic) IBOutlet UITableView *announcementTableView;
@end @end
...@@ -7,8 +7,38 @@ ...@@ -7,8 +7,38 @@
// //
#import "AnnouncementViewController.h" #import "AnnouncementViewController.h"
#import "AnnouncementTableViewCell.h"
#import "ScreeningButton.h"
@interface AnnouncementViewController () @interface AnnouncementViewController ()<UITableViewDelegate,UITableViewDataSource,ReturnTableviewcellIndexpathdelegate>
/**
公告请求
*/
@property (nonatomic,strong) AfficheCondition *afficheModel;
/**
公告结果
*/
@property (nonatomic,strong) NSMutableArray *afficheArray;
/**
总页数
*/
@property (nonatomic,assign) NSInteger totalPage;
/**
时间
*/
@property (nonatomic,strong) NSMutableArray *timeArray;
/**
类别
*/
@property (nonatomic,strong) NSMutableArray *typeArray;
@property (nonatomic,strong) ScreeningButton *dateButton;
@property (nonatomic,strong) ScreeningButton *typeButton;
@end @end
...@@ -16,23 +46,225 @@ ...@@ -16,23 +46,225 @@
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
// Do any additional setup after loading the view.
[self setUpTableView];
[self setUpChooseView];
[self setUpRefreshAction];
}
#pragma mark - UITableView
- (void)setUpTableView
{
self.announcementTableView.tableFooterView = [UIView new];
self.announcementTableView.rowHeight = 80;
}
#pragma mark - 筛选
- (void)setUpChooseView
{
self.dateButton = [ScreeningButton buttonWithType:UIButtonTypeCustom];
self.dateButton.frame = CGRectMake(ScreenWidth-400, (self.chooseBackgroundView.height-30)/2, 150, 30);
[self.dateButton setTitle:@"时间" forState:UIControlStateNormal];
[self.dateButton addTarget:self action:@selector(dateChooseButtonClick:) forControlEvents:UIControlEventTouchUpInside];
self.typeButton = [ScreeningButton buttonWithType:UIButtonTypeCustom];
self.typeButton.frame = CGRectMake(ScreenWidth-200, (self.chooseBackgroundView.height-30)/2, 150, 30);
[self.typeButton setTitle:@"类别" forState:UIControlStateNormal];
[self.typeButton addTarget:self action:@selector(typeChooseButtonClick:) forControlEvents:UIControlEventTouchUpInside];
[self.chooseBackgroundView addSubview:self.dateButton];
[self.chooseBackgroundView addSubview:self.typeButton];
}
#pragma mark - 时间选择
- (void)dateChooseButtonClick:(UIButton *)sender
{
[self showPopoverViewController:CGSizeMake(150, 200) withdatas:self.timeArray showButton:sender buttonCode:0];
}
#pragma mark - 类别选择
- (void)typeChooseButtonClick:(UIButton *)sender
{
[self showPopoverViewController:CGSizeMake(150, 200) withdatas:self.typeArray showButton:sender buttonCode:1];
}
#pragma mark - 时间排序
- (IBAction)dateSortButtonClickAction:(UIButton *)sender {
sender.selected = !sender.selected;
self.afficheModel.order = sender.selected?SORTDIRECTION_ASC:SORTDIRECTION_DESC;
[self.announcementTableView.mj_header beginRefreshing];
}
#pragma mark -弹出popover视图控制器
- (void)showPopoverViewController:(CGSize)size withdatas:(NSArray *)datasArray showButton:(UIButton *)button buttonCode:(NSInteger)code
{
PopoverViewController *popover = [[PopoverViewController alloc]init];
popover.datasArray = datasArray;
popover.delegate = self;
popover.contentSize = size;
popover.isString = YES;
popover.Selectedindex = code;
popover.preferredContentSize = size;
popover.modalPresentationStyle = UIModalPresentationPopover;
UIPopoverPresentationController *pop = popover.popoverPresentationController;
pop.permittedArrowDirections = UIPopoverArrowDirectionAny;
pop.sourceView = popover.view;
pop.barButtonItem = [[UIBarButtonItem alloc]initWithCustomView:button];
[self presentViewController:popover animated:YES completion:nil];
}
#pragma mark -选中筛选条件回传typecode
- (void)returnCellindexpathwithrow:(NSString *)Type WithcellTitle:(NSString *)title Withselected:(NSInteger)Selected
{
//时间
if (Selected == 0) {
self.afficheModel.dayCountEquals = [self timeString:title];
[self.dateButton setTitle:title forState:UIControlStateNormal];
}else
{//类型
self.afficheModel.afficheTypeEuals = [title isEqualToString:@"全部"]?nil:title;
[self.typeButton setTitle:title forState:UIControlStateNormal];
}
[self.announcementTableView.mj_header beginRefreshing];
}
#pragma mark - 时间转换
- (NSInteger)timeString:(NSString *)string
{
NSInteger dayCount = 0;
if ([string isEqualToString:@"全部"]) {
dayCount = 0;
}
if ([string isEqualToString:@"近三天"]) {
dayCount = 3;;
}
if ([string isEqualToString:@"近一周"]) {
dayCount = 7;
}
if ([string isEqualToString:@"近一个月"]) {
dayCount = 30;
}
return dayCount;
}
#pragma mark - Refresh
- (void)setUpRefreshAction
{
WS(weakSelf);
MjRefreshHeaderCustom *headerRefresh = [MjRefreshHeaderCustom headerWithRefreshingBlock:^{
[weakSelf.announcementTableView.mj_footer resetNoMoreData];
weakSelf.afficheModel.page.page = ONE;
[weakSelf getAnnouncementDatas:YES];
}];
headerRefresh.stateLabel.hidden = YES;
headerRefresh.lastUpdatedTimeLabel.hidden = YES;
[headerRefresh beginRefreshing];
self.announcementTableView.mj_header = headerRefresh;
MJRefreshAutoNormalFooter *footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
if (++ weakSelf.afficheModel.page.page >= weakSelf.totalPage) {
[weakSelf.announcementTableView.mj_footer endRefreshingWithNoMoreData];
}else{
[weakSelf getAnnouncementDatas:NO];
}
}];
footer.automaticallyHidden = YES;
self.announcementTableView.mj_footer = footer;
}
#pragma mark - 公告数据
- (void)getAnnouncementDatas:(BOOL)isRemove
{
WS(weakSelf);
[self CreateMBProgressHUDLoding];
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:SERVERREQUESTURL(AFFICHELIST) WithCallClass:weakSelf WithRequestType:ZERO WithParameter:self.afficheModel WithReturnValueBlock:^(id returnValue) {
[weakSelf RemoveMBProgressHUDLoding];
[weakSelf endRefreshingForTableView:weakSelf.announcementTableView];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
if (isRemove) {
[weakSelf.afficheArray removeAllObjects];
}
AfficheResponse *respone = [[AfficheResponse alloc]initWithDictionary:returnValue[@"data"] error:nil];
weakSelf.totalPage = respone.totalpages;
[weakSelf.afficheArray addObjectsFromArray:respone.afficheEntity];
}else {
[weakSelf ErrorMBProgressView:returnValue[@"message"]];
}
[weakSelf.announcementTableView reloadData];
} WithErrorCodeBlock:^(id errorCodeValue) {
[weakSelf RemoveMBProgressHUDLoding];
[weakSelf endRefreshingForTableView:weakSelf.announcementTableView];
[weakSelf ErrorMBProgressView:NETWORK];
} WithFailureBlock:^(NSError *error) {
[weakSelf RemoveMBProgressHUDLoding];
[weakSelf endRefreshingForTableView:weakSelf.announcementTableView];
[weakSelf ErrorMBProgressView:error.localizedDescription];
}];
}
#pragma mark - <UITableViewDelegate,UITableViewDataSource>
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
AnnouncementTableViewCell *announcementCell = [tableView dequeueReusableCellWithIdentifier:@"AnnouncementTableViewCell" forIndexPath:indexPath];
announcementCell.afficheEntity = self.afficheArray[indexPath.row];
return announcementCell;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return self.afficheArray.count;
}
#pragma mark - lazy
- (AfficheCondition *)afficheModel
{
if (!_afficheModel) {
_afficheModel = [[AfficheCondition alloc]init];
DataPage *page = [[DataPage alloc]init];
page.page = ONE;
page.rows = KROWS;
_afficheModel.page = page;
_afficheModel.dayCountEquals = 20;
// _afficheModel.userIdEquals = [Shoppersmanager manager].Shoppers.employee.fid;
}
return _afficheModel;
} }
- (void)didReceiveMemoryWarning { - (NSMutableArray *)afficheArray
[super didReceiveMemoryWarning]; {
// Dispose of any resources that can be recreated. if (!_afficheArray) {
_afficheArray = [NSMutableArray array];
}
return _afficheArray;
} }
/* - (NSMutableArray *)timeArray
#pragma mark - Navigation {
if (!_timeArray) {
_timeArray = [NSMutableArray arrayWithObjects:@"全部",@"近三天",@"近一周",@"近一个月", nil];
}
return _timeArray;
}
// In a storyboard-based application, you will often want to do a little preparation before navigation - (NSMutableArray *)typeArray
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { {
// Get the new view controller using [segue destinationViewController]. if (!_typeArray) {
// Pass the selected object to the new view controller. _typeArray = [NSMutableArray arrayWithObjects:@"全部",@"品牌资讯",@"行业动态",@"活动公告", nil];
}
return _typeArray;
} }
*/
@end @end
//
// AnnountcementDetailViewController.h
// Lighting
//
// Created by 曹云霄 on 2016/11/23.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "BaseViewController.h"
@interface AnnountcementDetailViewController : BaseViewController
@end
//
// AnnountcementDetailViewController.m
// Lighting
//
// Created by 曹云霄 on 2016/11/23.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "AnnountcementDetailViewController.h"
@interface AnnountcementDetailViewController ()
@end
@implementation AnnountcementDetailViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
//
// CustomBorderLabel.h
// Lighting
//
// Created by 曹云霄 on 2016/11/23.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface CustomBorderLabel : UILabel
@property (nonatomic,strong) NSString *customText;
@end
//
// CustomBorderLabel.m
// Lighting
//
// Created by 曹云霄 on 2016/11/23.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "CustomBorderLabel.h"
@implementation CustomBorderLabel
- (instancetype)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
self.font = [UIFont systemFontOfSize:12];
}
return self;
}
- (void)setCustomText:(NSString *)customText
{
_customText = customText;
UIColor *color;
if ([customText isEqualToString:@"行业动态"]) {
color = RGB(133, 210, 107, 1);
}else if ([customText isEqualToString:@"品牌资讯"]) {
color = RGB(0, 127, 210, 1);
}else if ([customText isEqualToString:@"活动公告"]) {
color = RGB(241, 171, 0, 1);
}
self.layer.masksToBounds = YES;
self.layer.borderWidth = 1.0f;
self.layer.borderColor = color.CGColor;
self.layer.cornerRadius = 2.0f;
self.textColor = color;
self.text = _customText;
}
@end
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
// //
#import "BaseViewController.h" #import "BaseViewController.h"
#import "screeningButton.h" #import "ScreeningButton.h"
@interface CustomerOrderViewController : BaseViewController @interface CustomerOrderViewController : BaseViewController
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
/** /**
* 订单状态按钮 * 订单状态按钮
*/ */
@property (strong, nonatomic) screeningButton *StyleButton; @property (strong, nonatomic) ScreeningButton *styleButton;
/** /**
* 上传参数模型 * 上传参数模型
......
...@@ -102,15 +102,15 @@ ...@@ -102,15 +102,15 @@
self.customerOrderTableView.dataSource = self; self.customerOrderTableView.dataSource = self;
self.customerOrderTableView.delegate = self; self.customerOrderTableView.delegate = self;
self.customerOrderTableView.backgroundColor = [UIColor clearColor]; self.customerOrderTableView.backgroundColor = [UIColor clearColor];
self.StyleButton = [screeningButton buttonWithType:UIButtonTypeCustom]; self.styleButton = [ScreeningButton buttonWithType:UIButtonTypeCustom];
self.StyleButton.frame = CGRectMake(ScreenWidth-250, 20, 150, 30); self.styleButton.frame = CGRectMake(ScreenWidth-250, 20, 150, 30);
self.StyleButton.backgroundColor = kTCColor(131, 131, 131); self.styleButton.backgroundColor = kTCColor(131, 131, 131);
[self.StyleButton setTitle:@"订单状态" forState:UIControlStateNormal]; [self.styleButton setTitle:@"订单状态" forState:UIControlStateNormal];
[self.StyleButton addTarget:self action:@selector(OrderStateButtonClick:) forControlEvents:UIControlEventTouchUpInside]; [self.styleButton addTarget:self action:@selector(OrderStateButtonClick:) forControlEvents:UIControlEventTouchUpInside];
[self.StyleButton setImage:TCImage(@"down_arr") forState:UIControlStateNormal]; [self.styleButton setImage:TCImage(@"down_arr") forState:UIControlStateNormal];
self.StyleButton.layer.masksToBounds = YES; self.styleButton.layer.masksToBounds = YES;
self.StyleButton.layer.cornerRadius = 10; self.styleButton.layer.cornerRadius = 10;
[self.orderStateBackView addSubview:self.StyleButton]; [self.orderStateBackView addSubview:self.styleButton];
//经销商代码 //经销商代码
self.model.resellerCodeEquals = [[Shoppersmanager manager].Shoppers.employee.currentDepart orgCode]; self.model.resellerCodeEquals = [[Shoppersmanager manager].Shoppers.employee.currentDepart orgCode];
//下拉刷新 //下拉刷新
...@@ -276,7 +276,7 @@ ...@@ -276,7 +276,7 @@
*/ */
- (void)returnCellindexpathwithrow:(NSString *)Type WithcellTitle:(NSString *)title Withselected:(NSInteger)Selected - (void)returnCellindexpathwithrow:(NSString *)Type WithcellTitle:(NSString *)title Withselected:(NSInteger)Selected
{ {
[self.StyleButton setTitle:title forState:UIControlStateNormal]; [self.styleButton setTitle:title forState:UIControlStateNormal];
[self dismissViewControllerAnimated:YES completion:nil]; [self dismissViewControllerAnimated:YES completion:nil];
NSString *orderState = nil; NSString *orderState = nil;
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
[super viewDidLoad]; [super viewDidLoad];
[self addGestureRecognizer]; [self addGestureRecognizer];
[self queryIntegralDetails];
} }
#pragma mark - 添加点击 #pragma mark - 添加点击
...@@ -30,6 +31,34 @@ ...@@ -30,6 +31,34 @@
[self.breakthroughView addGestureRecognizer:[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(breakthroughViewClickAction:)]]; [self.breakthroughView addGestureRecognizer:[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(breakthroughViewClickAction:)]];
} }
#pragma mark - 查询积分明细
- (void)queryIntegralDetails
{
WS(weakSelf);
[self CreateMBProgressHUDLoding];
NSString *url = [NSString stringWithFormat:SERVERREQUESTURL(INTEGRALQUERY),[Shoppersmanager manager].Shoppers.employee.fid];
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:url WithCallClass:weakSelf WithRequestType:ONE WithParameter:nil WithReturnValueBlock:^(id returnValue) {
[weakSelf RemoveMBProgressHUDLoding];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
RsScoreDetails *integralDatas = [[RsScoreDetails alloc]initWithDictionary:returnValue[@"data"] error:nil];
}else {
[weakSelf ErrorMBProgressView:returnValue[@"message"]];
}
} WithErrorCodeBlock:^(id errorCodeValue) {
[weakSelf RemoveMBProgressHUDLoding];
[weakSelf ErrorMBProgressView:NETWORK];
} WithFailureBlock:^(NSError *error) {
[weakSelf RemoveMBProgressHUDLoding];
[weakSelf ErrorMBProgressView:error.localizedDescription];
}];
}
#pragma mark - 综合讨论 #pragma mark - 综合讨论
- (void)comprehensiveDiscussionViewClickAction:(UITapGestureRecognizer *)sender - (void)comprehensiveDiscussionViewClickAction:(UITapGestureRecognizer *)sender
{ {
......
...@@ -246,8 +246,8 @@ ...@@ -246,8 +246,8 @@
SceneLibraryViewController *sceneVC = [SHARED_APPDELEGATE.allControllerArray objectAtIndex_opple:6]; SceneLibraryViewController *sceneVC = [SHARED_APPDELEGATE.allControllerArray objectAtIndex_opple:6];
sceneVC.conditionModel.styleEquals = nil; sceneVC.conditionModel.styleEquals = nil;
sceneVC.conditionModel.spaceEquals = nil; sceneVC.conditionModel.spaceEquals = nil;
[sceneVC.StyleButton setTitle:@"风格" forState:UIControlStateNormal]; [sceneVC.styleButton setTitle:@"风格" forState:UIControlStateNormal];
[sceneVC.SpaceButton setTitle:@"空间" forState:UIControlStateNormal]; [sceneVC.spaceButton setTitle:@"空间" forState:UIControlStateNormal];
[sceneVC.seceneLibararyCollectionView.mj_header beginRefreshing]; [sceneVC.seceneLibararyCollectionView.mj_header beginRefreshing];
}else if ([Name isEqualToString:@"产品库"]) }else if ([Name isEqualToString:@"产品库"])
...@@ -281,7 +281,7 @@ ...@@ -281,7 +281,7 @@
selectedIndex = 9; selectedIndex = 9;
CustomerOrderViewController *customerVC = [SHARED_APPDELEGATE.allControllerArray objectAtIndex_opple:9]; CustomerOrderViewController *customerVC = [SHARED_APPDELEGATE.allControllerArray objectAtIndex_opple:9];
customerVC.searchCustomerOrder.text = nil; customerVC.searchCustomerOrder.text = nil;
[customerVC.StyleButton setTitle:@"全部订单" forState:UIControlStateNormal]; [customerVC.styleButton setTitle:@"全部订单" forState:UIControlStateNormal];
customerVC.model.consumerNameOrMobileEquals = nil; customerVC.model.consumerNameOrMobileEquals = nil;
customerVC.model.orderStateEquals = nil; customerVC.model.orderStateEquals = nil;
[customerVC.customerOrderTableView.mj_header beginRefreshing]; [customerVC.customerOrderTableView.mj_header beginRefreshing];
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
- (void)awakeFromNib { - (void)awakeFromNib {
[super awakeFromNib]; [super awakeFromNib];
// Initialization code
} }
- (void)setBillEntity:(TOPrizeBillEntity *)billEntity - (void)setBillEntity:(TOPrizeBillEntity *)billEntity
...@@ -20,6 +19,9 @@ ...@@ -20,6 +19,9 @@
_billEntity = billEntity; _billEntity = billEntity;
self.exchangeBillNumberLabel.text = _billEntity.billnumber; self.exchangeBillNumberLabel.text = _billEntity.billnumber;
self.exchangeTimeLabel.text = _billEntity.createDate; self.exchangeTimeLabel.text = _billEntity.createDate;
NSDictionary *textDict = [BaseViewController returnPrizeBillStateTitleColor:_billEntity.state];
self.exchangeStateLabel.text = textDict[@"title"];
self.exchangeStateLabel.textColor = textDict[@"color"];
} }
@end @end
...@@ -15,10 +15,14 @@ ...@@ -15,10 +15,14 @@
// Initialization code // Initialization code
} }
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state - (void)setConsigneeEntity:(TOPrizeBillEntity *)consigneeEntity
{
_consigneeEntity = consigneeEntity;
self.consigneeLabel.text = _consigneeEntity.receiver;
self.addressLabel.text = _consigneeEntity.receiveAddress;
self.phoneNumberLabel.text = _consigneeEntity.mobilephone;
} }
@end @end
//
// PrizeExchangeCourierTableViewCell.h
// Lighting
//
// Created by 曹云霄 on 2016/11/23.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface PrizeExchangeCourierTableViewCell : UITableViewCell
/**
物流公司
*/
@property (weak, nonatomic) IBOutlet UILabel *courierCompanyLabel;
/**
物流单号
*/
@property (weak, nonatomic) IBOutlet UILabel *courierNumberLabel;
@end
//
// PrizeExchangeCourierTableViewCell.m
// Lighting
//
// Created by 曹云霄 on 2016/11/23.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "PrizeExchangeCourierTableViewCell.h"
@implementation PrizeExchangeCourierTableViewCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
...@@ -15,14 +15,18 @@ ...@@ -15,14 +15,18 @@
- ExchangeBillInformation: 兑换单信息 - ExchangeBillInformation: 兑换单信息
- ReceivingInformation: 收货信息 - ReceivingInformation: 收货信息
- RewardInformation: 奖励信息 - RewardInformation: 奖励信息
- LogisticsInformation: 物流信息
*/ */
typedef NS_ENUM(NSInteger,CellType){ typedef NS_ENUM(NSInteger,CellType){
ExchangeBillInformation = 0, ExchangeBillInformation = 0,
ReceivingInformation, ReceivingInformation,
RewardInformation RewardInformation,
LogisticsInformation
}; };
@interface PrizeExchangeDetailsViewController : BaseViewController @interface PrizeExchangeDetailsViewController : BaseViewController
@property (weak, nonatomic) IBOutlet UITableView *prizeExchangeDetailsTableView; @property (weak, nonatomic) IBOutlet UITableView *prizeExchangeDetailsTableView;
/** /**
...@@ -30,4 +34,9 @@ typedef NS_ENUM(NSInteger,CellType){ ...@@ -30,4 +34,9 @@ typedef NS_ENUM(NSInteger,CellType){
*/ */
@property (nonatomic,copy) NSString *prizeBillNumber; @property (nonatomic,copy) NSString *prizeBillNumber;
/**
是否有物流信息
*/
@property (nonatomic,assign) BOOL isDelivery;
@end @end
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#import "PrizeExchangeSectionTableViewCell.h" #import "PrizeExchangeSectionTableViewCell.h"
#import "PrizeExchangeInformationTableViewCell.h" #import "PrizeExchangeInformationTableViewCell.h"
#import "PrizeExchangeConsigneeTableViewCell.h" #import "PrizeExchangeConsigneeTableViewCell.h"
#import "PrizeExchangeCourierTableViewCell.h"
@interface PrizeExchangeDetailsViewController ()<UITableViewDelegate,UITableViewDataSource> @interface PrizeExchangeDetailsViewController ()<UITableViewDelegate,UITableViewDataSource>
...@@ -24,7 +25,7 @@ ...@@ -24,7 +25,7 @@
/** /**
section title Array section title Array
*/ */
@property (nonatomic,strong) NSArray *sectionTitleArray; @property (nonatomic,strong) NSMutableArray *sectionTitleArray;
@end @end
...@@ -41,6 +42,7 @@ ...@@ -41,6 +42,7 @@
- (void)setUpTableView - (void)setUpTableView
{ {
self.prizeExchangeDetailsTableView.tableFooterView = [UIView new]; self.prizeExchangeDetailsTableView.tableFooterView = [UIView new];
self.prizeExchangeDetailsTableView.sectionHeaderHeight = 60;
} }
#pragma mark - 兑奖记录详情 #pragma mark - 兑奖记录详情
...@@ -91,7 +93,12 @@ ...@@ -91,7 +93,12 @@
return rewardCell; return rewardCell;
} }
break; break;
case LogisticsInformation:
{
PrizeExchangeCourierTableViewCell *logisticsCell = [tableView dequeueReusableCellWithIdentifier:@"PrizeExchangeCourierTableViewCell" forIndexPath:indexPath];
return logisticsCell;
}
break;
default: default:
break; break;
} }
...@@ -100,17 +107,12 @@ ...@@ -100,17 +107,12 @@
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{ {
return 1; return ONE;
} }
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{ {
return 3; return self.sectionTitleArray.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 60;
} }
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
...@@ -121,10 +123,13 @@ ...@@ -121,10 +123,13 @@
} }
#pragma mark - lazy #pragma mark - lazy
- (NSArray *)sectionTitleArray - (NSMutableArray *)sectionTitleArray
{ {
if (!_sectionTitleArray) { if (!_sectionTitleArray) {
_sectionTitleArray = @[@"兑换单信息",@"收货信息",@"奖励信息",@"物流信息"]; _sectionTitleArray = [NSMutableArray arrayWithObjects:@"兑换单信息",@"收货信息",@"奖励信息", nil];
if (self.isDelivery) {
[_sectionTitleArray addObject:@"物流信息"];
}
} }
return _sectionTitleArray; return _sectionTitleArray;
} }
......
...@@ -210,7 +210,7 @@ ...@@ -210,7 +210,7 @@
self.productCollectionView.dataSource = self; self.productCollectionView.dataSource = self;
self.productCollectionView.delegate = self; self.productCollectionView.delegate = self;
self.productCollectionView.alwaysBounceVertical = YES; self.productCollectionView.alwaysBounceVertical = YES;
[self CreatescreeningButton]; [self CreateScreeningButton];
} }
#pragma mark -获取数据 #pragma mark -获取数据
...@@ -375,10 +375,10 @@ ...@@ -375,10 +375,10 @@
#pragma mark -筛选按钮 #pragma mark -筛选按钮
- (void)CreatescreeningButton - (void)CreateScreeningButton
{ {
UIButton *screeningbutton = [UIButton buttonWithType:UIButtonTypeSystem]; UIButton *ScreeningButton = [UIButton buttonWithType:UIButtonTypeSystem];
screeningbutton.frame = CGRectMake(ScreenWidth-100, ScreenHeight*6/10, 50, 50); ScreeningButton.frame = CGRectMake(ScreenWidth-100, ScreenHeight*6/10, 50, 50);
//阴影层 //阴影层
CALayer *layer = [CALayer layer]; CALayer *layer = [CALayer layer];
...@@ -390,15 +390,15 @@ ...@@ -390,15 +390,15 @@
[self.view.layer addSublayer:layer]; [self.view.layer addSublayer:layer];
//筛选按钮 //筛选按钮
screeningbutton.layer.masksToBounds = YES; ScreeningButton.layer.masksToBounds = YES;
screeningbutton.layer.cornerRadius = 25; ScreeningButton.layer.cornerRadius = 25;
[screeningbutton setTitle:@"筛选" forState:UIControlStateNormal]; [ScreeningButton setTitle:@"筛选" forState:UIControlStateNormal];
screeningbutton.titleLabel.font = [UIFont systemFontOfSize:15]; ScreeningButton.titleLabel.font = [UIFont systemFontOfSize:15];
[screeningbutton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [ScreeningButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[screeningbutton setTitleColor:kMainBlueColor forState:UIControlStateSelected]; [ScreeningButton setTitleColor:kMainBlueColor forState:UIControlStateSelected];
[screeningbutton addTarget:self action:@selector(ScreeningButtonClick) forControlEvents:UIControlEventTouchUpInside]; [ScreeningButton addTarget:self action:@selector(ScreeningButtonClick) forControlEvents:UIControlEventTouchUpInside];
screeningbutton.backgroundColor = kMainBlueColor; ScreeningButton.backgroundColor = kMainBlueColor;
[self.view addSubview:screeningbutton]; [self.view addSubview:ScreeningButton];
} }
...@@ -567,7 +567,7 @@ ...@@ -567,7 +567,7 @@
self.screenFirstView = [[[NSBundle mainBundle] loadNibNamed:@"screeningFirstView" owner:self options:nil] firstObject]; self.screenFirstView = [[[NSBundle mainBundle] loadNibNamed:@"screeningFirstView" owner:self options:nil] firstObject];
self.screenFirstView.frame = CGRectMake(0, 50, 470, 310); self.screenFirstView.frame = CGRectMake(0, 50, 470, 310);
self.screenFirstView.delegate = self; self.screenFirstView.delegate = self;
[self screeningButtonClick:self.selectedIndex]; [self ScreeningButtonClick:self.selectedIndex];
[self.screenView.backgroundView addSubview:self.screenFirstView]; [self.screenView.backgroundView addSubview:self.screenFirstView];
} }
...@@ -578,14 +578,14 @@ ...@@ -578,14 +578,14 @@
self.screenSecondView = [[[NSBundle mainBundle] loadNibNamed:@"screeningSecondView" owner:self options:nil] firstObject]; self.screenSecondView = [[[NSBundle mainBundle] loadNibNamed:@"screeningSecondView" owner:self options:nil] firstObject];
self.screenSecondView.frame = CGRectMake(0, 50, 470, 310); self.screenSecondView.frame = CGRectMake(0, 50, 470, 310);
self.screenSecondView.delegate = self; self.screenSecondView.delegate = self;
[self screeningButtonClick:self.selectedIndex]; [self ScreeningButtonClick:self.selectedIndex];
self.screenSecondView.totalNumber = self.datasArray.count; self.screenSecondView.totalNumber = self.datasArray.count;
[self.screenView.backgroundView addSubview:self.screenSecondView]; [self.screenView.backgroundView addSubview:self.screenSecondView];
} }
#pragma mark -ScreeningButtonClickdelegate代理 #pragma mark -ScreeningButtonClickdelegate代理
- (void)screeningButtonClick:(NSInteger)buttontag - (void)ScreeningButtonClick:(NSInteger)buttontag
{ {
self.selectedIndex = buttontag; self.selectedIndex = buttontag;
//分类 //分类
...@@ -622,7 +622,7 @@ ...@@ -622,7 +622,7 @@
- (void)tableSelectedindex:(NSInteger)index - (void)tableSelectedindex:(NSInteger)index
{ {
[self screeningButtonClick:index]; [self ScreeningButtonClick:index];
self.screenView.indexselected = index; self.screenView.indexselected = index;
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
// //
#import "BaseViewController.h" #import "BaseViewController.h"
#import "screeningButton.h" #import "ScreeningButton.h"
@interface SceneLibraryViewController : BaseViewController @interface SceneLibraryViewController : BaseViewController
...@@ -38,13 +38,13 @@ ...@@ -38,13 +38,13 @@
/** /**
* 风格按钮 * 风格按钮
*/ */
@property (strong, nonatomic) screeningButton *StyleButton; @property (strong, nonatomic) ScreeningButton *styleButton;
/** /**
* 房型按钮 * 房型按钮
*/ */
@property (strong, nonatomic) screeningButton *SpaceButton; @property (strong, nonatomic) ScreeningButton *spaceButton;
/** /**
......
...@@ -101,24 +101,16 @@ ...@@ -101,24 +101,16 @@
self.seceneLibararyCollectionView.delegate = self; self.seceneLibararyCollectionView.delegate = self;
//设置按钮 //设置按钮
self.StyleButton = [screeningButton buttonWithType:UIButtonTypeCustom]; self.styleButton = [ScreeningButton buttonWithType:UIButtonTypeCustom];
self.StyleButton.frame = CGRectMake(ScreenWidth-400, 14, 150, 30); self.styleButton.frame = CGRectMake(ScreenWidth-400, 14, 150, 30);
self.StyleButton.backgroundColor = kTCColor(131, 131, 131); [self.styleButton setTitle:@"风格" forState:UIControlStateNormal];
[self.StyleButton setTitle:@"风格" forState:UIControlStateNormal]; [self.styleButton addTarget:self action:@selector(screeningstyleButtonClick:) forControlEvents:UIControlEventTouchUpInside];
[self.StyleButton addTarget:self action:@selector(screeningStyleButtonClick:) forControlEvents:UIControlEventTouchUpInside]; self.spaceButton = [ScreeningButton buttonWithType:UIButtonTypeCustom];
[self.StyleButton setImage:TCImage(@"down_arr") forState:UIControlStateNormal]; self.spaceButton.frame = CGRectMake(ScreenWidth-200, 14, 150, 30);
self.StyleButton.layer.masksToBounds = YES; [self.spaceButton setTitle:@"空间" forState:UIControlStateNormal];
self.StyleButton.layer.cornerRadius = 10; [self.spaceButton addTarget:self action:@selector(HousestyleButtonClick:) forControlEvents:UIControlEventTouchUpInside];
self.SpaceButton = [screeningButton buttonWithType:UIButtonTypeCustom]; [self.backView addSubview:self.styleButton];
self.SpaceButton.frame = CGRectMake(ScreenWidth-200, 14, 150, 30); [self.backView addSubview:self.spaceButton];
[self.SpaceButton setTitle:@"空间" forState:UIControlStateNormal];
self.SpaceButton.layer.masksToBounds = YES;
self.SpaceButton.backgroundColor = kTCColor(131, 131, 131);
[self.SpaceButton addTarget:self action:@selector(HouseStyleButtonClick:) forControlEvents:UIControlEventTouchUpInside];
[self.SpaceButton setImage:TCImage(@"down_arr") forState:UIControlStateNormal];
self.SpaceButton.layer.cornerRadius = 10;
[self.backView addSubview:self.StyleButton];
[self.backView addSubview:self.SpaceButton];
//下拉刷新 //下拉刷新
WS(weakSelf); WS(weakSelf);
...@@ -248,7 +240,7 @@ ...@@ -248,7 +240,7 @@
#pragma mark -筛选风格 #pragma mark -筛选风格
- (void)screeningStyleButtonClick:(UIButton *)sender { - (void)screeningstyleButtonClick:(UIButton *)sender {
NSMutableArray *styleArray = [NSMutableArray arrayWithArray:self.filter.styles]; NSMutableArray *styleArray = [NSMutableArray arrayWithArray:self.filter.styles];
DataDict *style = [[DataDict alloc]init]; DataDict *style = [[DataDict alloc]init];
...@@ -260,7 +252,7 @@ ...@@ -260,7 +252,7 @@
#pragma mark -空间风格 #pragma mark -空间风格
- (void)HouseStyleButtonClick:(UIButton *)sender { - (void)HousestyleButtonClick:(UIButton *)sender {
NSMutableArray *spaceArray = [NSMutableArray arrayWithArray:self.filter.space]; NSMutableArray *spaceArray = [NSMutableArray arrayWithArray:self.filter.space];
DataDict *space = [[DataDict alloc]init]; DataDict *space = [[DataDict alloc]init];
...@@ -295,18 +287,16 @@ ...@@ -295,18 +287,16 @@
#pragma mark -选中筛选条件回传typecode #pragma mark -选中筛选条件回传typecode
- (void)returnCellindexpathwithrow:(NSString *)Type WithcellTitle:(NSString *)title Withselected:(NSInteger)Selected - (void)returnCellindexpathwithrow:(NSString *)Type WithcellTitle:(NSString *)title Withselected:(NSInteger)Selected
{ {
[self dismissViewControllerAnimated:YES completion:nil];
//空间code //空间code
if (Selected) { if (Selected) {
self.conditionModel.spaceEquals = Type; self.conditionModel.spaceEquals = Type;
[self.SpaceButton setTitle:[title isEqualToString:@"全部"]?@"空间":title forState:UIControlStateNormal]; [self.spaceButton setTitle:[title isEqualToString:@"全部"]?@"空间":title forState:UIControlStateNormal];
}else }else
{//风格code {//风格code
self.conditionModel.styleEquals = Type; self.conditionModel.styleEquals = Type;
[self.StyleButton setTitle:[title isEqualToString:@"全部"]?@"风格":title forState:UIControlStateNormal]; [self.styleButton setTitle:[title isEqualToString:@"全部"]?@"风格":title forState:UIControlStateNormal];
} }
[self.seceneLibararyCollectionView.mj_header beginRefreshing]; [self.seceneLibararyCollectionView.mj_header beginRefreshing];
} }
...@@ -315,7 +305,6 @@ ...@@ -315,7 +305,6 @@
#pragma mark -筛选条件回传cellindex #pragma mark -筛选条件回传cellindex
- (void)returnWithIndexSelected:(NSInteger)selectedIndex - (void)returnWithIndexSelected:(NSInteger)selectedIndex
{ {
NSInteger showcellNumber = 0; NSInteger showcellNumber = 0;
switch (selectedIndex) { switch (selectedIndex) {
case 0: case 0:
...@@ -338,7 +327,6 @@ ...@@ -338,7 +327,6 @@
break; break;
} }
[self.accordingStyle setBackgroundImage:TCImage([self.imageArray objectAtIndex_opple:selectedIndex]) forState:UIControlStateNormal]; [self.accordingStyle setBackgroundImage:TCImage([self.imageArray objectAtIndex_opple:selectedIndex]) forState:UIControlStateNormal];
[self dismissViewControllerAnimated:YES completion:nil];
self.seceneLibraryCollectionLayout.itemSize = CGSizeMake((ScreenWidth-showcellNumber*2)/showcellNumber, (ScreenWidth-showcellNumber*2)/showcellNumber-50); self.seceneLibraryCollectionLayout.itemSize = CGSizeMake((ScreenWidth-showcellNumber*2)/showcellNumber, (ScreenWidth-showcellNumber*2)/showcellNumber-50);
[self.seceneLibararyCollectionView reloadData]; [self.seceneLibararyCollectionView reloadData];
} }
......
// //
// screeningButton.h // ScreeningButton.h
// Lighting // Lighting
// //
// Created by 曹云霄 on 16/5/13. // Created by 曹云霄 on 16/5/13.
...@@ -8,6 +8,6 @@ ...@@ -8,6 +8,6 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
@interface screeningButton : UIButton @interface ScreeningButton : UIButton
@end @end
//
// ScreeningButton.m
// Lighting
//
// Created by 曹云霄 on 16/5/13.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "ScreeningButton.h"
@implementation ScreeningButton
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self.titleLabel.font = [UIFont systemFontOfSize:13];
self.titleLabel.textAlignment = NSTextAlignmentCenter;
[self setImage:TCImage(@"down_arr") forState:UIControlStateNormal];
self.layer.masksToBounds = YES;
self.layer.cornerRadius = 10;
self.backgroundColor = kTCColor(131, 131, 131);
}
return self;
}
- (CGRect)titleRectForContentRect:(CGRect)contentRect
{
return CGRectMake((self.frame.size.width-[self ReturnCGsize:self.currentTitle].width)/2, -2, [self ReturnCGsize:self.currentTitle].width, 35);
}
- (CGRect)imageRectForContentRect:(CGRect)contentRect
{
return CGRectMake((self.frame.size.width-[self ReturnCGsize:self.currentTitle].width)/2+[self ReturnCGsize:self.currentTitle].width, (self.frame.size.height-6)/2, 11, 6);
}
- (CGSize)ReturnCGsize:(NSString *)string
{
CGSize S = [string boundingRectWithSize:CGSizeMake(999, 35) options:NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:18]} context:nil].size;
return S;
}
@end
// //
// screeningButton.m // ScreeningButton.m
// Lighting // Lighting
// //
// Created by 曹云霄 on 16/5/13. // Created by 曹云霄 on 16/5/13.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved. // Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
// //
#import "screeningButton.h" #import "ScreeningButton.h"
@implementation screeningButton @implementation ScreeningButton
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
@required @required
- (void)screeningButtonClick:(NSInteger)buttontag; - (void)ScreeningButtonClick:(NSInteger)buttontag;
@end @end
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
#pragma mark -筛选按钮(风格、类型、空间、材质、价格) #pragma mark -筛选按钮(风格、类型、空间、材质、价格)
- (IBAction)screeningButtonClick:(UIButton *)sender { - (IBAction)ScreeningButtonClick:(UIButton *)sender {
switch (sender.tag) { switch (sender.tag) {
case 100://风格 case 100://风格
...@@ -87,9 +87,9 @@ ...@@ -87,9 +87,9 @@
break; break;
} }
if ([self.delegate respondsToSelector:@selector(screeningButtonClick:)]) { if ([self.delegate respondsToSelector:@selector(ScreeningButtonClick:)]) {
[self.delegate screeningButtonClick:sender.tag-100]; [self.delegate ScreeningButtonClick:sender.tag-100];
} }
[self RemoveAllButtonisSelected]; [self RemoveAllButtonisSelected];
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{
"images" : [
{
"idiom" : "universal",
"filename" : "Studybackground.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "asc.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "asc@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "asc@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "breakthrough.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "breakthrough@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "breakthrough@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "desc.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "desc@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "desc@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "forum.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "forum@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "forum@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "narrow.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "narrow@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "narrow@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "new.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "new@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "new@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "startEvaluation.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "startEvaluation@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "startEvaluation@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "stop.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "stop@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "stop@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "study.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "study@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "study@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
This diff is collapsed.
// AFAutoPurgingImageCache.h
// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <TargetConditionals.h>
#import <Foundation/Foundation.h>
#if TARGET_OS_IOS || TARGET_OS_TV
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/**
The `AFImageCache` protocol defines a set of APIs for adding, removing and fetching images from a cache synchronously.
*/
@protocol AFImageCache <NSObject>
/**
Adds the image to the cache with the given identifier.
@param image The image to cache.
@param identifier The unique identifier for the image in the cache.
*/
- (void)addImage:(UIImage *)image withIdentifier:(NSString *)identifier;
/**
Removes the image from the cache matching the given identifier.
@param identifier The unique identifier for the image in the cache.
@return A BOOL indicating whether or not the image was removed from the cache.
*/
- (BOOL)removeImageWithIdentifier:(NSString *)identifier;
/**
Removes all images from the cache.
@return A BOOL indicating whether or not all images were removed from the cache.
*/
- (BOOL)removeAllImages;
/**
Returns the image in the cache associated with the given identifier.
@param identifier The unique identifier for the image in the cache.
@return An image for the matching identifier, or nil.
*/
- (nullable UIImage *)imageWithIdentifier:(NSString *)identifier;
@end
/**
The `ImageRequestCache` protocol extends the `ImageCache` protocol by adding methods for adding, removing and fetching images from a cache given an `NSURLRequest` and additional identifier.
*/
@protocol AFImageRequestCache <AFImageCache>
/**
Adds the image to the cache using an identifier created from the request and additional identifier.
@param image The image to cache.
@param request The unique URL request identifing the image asset.
@param identifier The additional identifier to apply to the URL request to identify the image.
*/
- (void)addImage:(UIImage *)image forRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier;
/**
Removes the image from the cache using an identifier created from the request and additional identifier.
@param request The unique URL request identifing the image asset.
@param identifier The additional identifier to apply to the URL request to identify the image.
@return A BOOL indicating whether or not all images were removed from the cache.
*/
- (BOOL)removeImageforRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier;
/**
Returns the image from the cache associated with an identifier created from the request and additional identifier.
@param request The unique URL request identifing the image asset.
@param identifier The additional identifier to apply to the URL request to identify the image.
@return An image for the matching request and identifier, or nil.
*/
- (nullable UIImage *)imageforRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier;
@end
/**
The `AutoPurgingImageCache` in an in-memory image cache used to store images up to a given memory capacity. When the memory capacity is reached, the image cache is sorted by last access date, then the oldest image is continuously purged until the preferred memory usage after purge is met. Each time an image is accessed through the cache, the internal access date of the image is updated.
*/
@interface AFAutoPurgingImageCache : NSObject <AFImageRequestCache>
/**
The total memory capacity of the cache in bytes.
*/
@property (nonatomic, assign) UInt64 memoryCapacity;
/**
The preferred memory usage after purge in bytes. During a purge, images will be purged until the memory capacity drops below this limit.
*/
@property (nonatomic, assign) UInt64 preferredMemoryUsageAfterPurge;
/**
The current total memory usage in bytes of all images stored within the cache.
*/
@property (nonatomic, assign, readonly) UInt64 memoryUsage;
/**
Initialies the `AutoPurgingImageCache` instance with default values for memory capacity and preferred memory usage after purge limit. `memoryCapcity` defaults to `100 MB`. `preferredMemoryUsageAfterPurge` defaults to `60 MB`.
@return The new `AutoPurgingImageCache` instance.
*/
- (instancetype)init;
/**
Initialies the `AutoPurgingImageCache` instance with the given memory capacity and preferred memory usage
after purge limit.
@param memoryCapacity The total memory capacity of the cache in bytes.
@param preferredMemoryCapacity The preferred memory usage after purge in bytes.
@return The new `AutoPurgingImageCache` instance.
*/
- (instancetype)initWithMemoryCapacity:(UInt64)memoryCapacity preferredMemoryCapacity:(UInt64)preferredMemoryCapacity;
@end
NS_ASSUME_NONNULL_END
#endif
This diff is collapsed.
// AFImageDownloader.h
// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <TargetConditionals.h>
#if TARGET_OS_IOS || TARGET_OS_TV
#import <Foundation/Foundation.h>
#import "AFAutoPurgingImageCache.h"
#import "AFHTTPSessionManager.h"
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger, AFImageDownloadPrioritization) {
AFImageDownloadPrioritizationFIFO,
AFImageDownloadPrioritizationLIFO
};
/**
The `AFImageDownloadReceipt` is an object vended by the `AFImageDownloader` when starting a data task. It can be used to cancel active tasks running on the `AFImageDownloader` session. As a general rule, image data tasks should be cancelled using the `AFImageDownloadReceipt` instead of calling `cancel` directly on the `task` itself. The `AFImageDownloader` is optimized to handle duplicate task scenarios as well as pending versus active downloads.
*/
@interface AFImageDownloadReceipt : NSObject
/**
The data task created by the `AFImageDownloader`.
*/
@property (nonatomic, strong) NSURLSessionDataTask *task;
/**
The unique identifier for the success and failure blocks when duplicate requests are made.
*/
@property (nonatomic, strong) NSUUID *receiptID;
@end
/** The `AFImageDownloader` class is responsible for downloading images in parallel on a prioritized queue. Incoming downloads are added to the front or back of the queue depending on the download prioritization. Each downloaded image is cached in the underlying `NSURLCache` as well as the in-memory image cache. By default, any download request with a cached image equivalent in the image cache will automatically be served the cached image representation.
*/
@interface AFImageDownloader : NSObject
/**
The image cache used to store all downloaded images in. `AFAutoPurgingImageCache` by default.
*/
@property (nonatomic, strong, nullable) id <AFImageRequestCache> imageCache;
/**
The `AFHTTPSessionManager` used to download images. By default, this is configured with an `AFImageResponseSerializer`, and a shared `NSURLCache` for all image downloads.
*/
@property (nonatomic, strong) AFHTTPSessionManager *sessionManager;
/**
Defines the order prioritization of incoming download requests being inserted into the queue. `AFImageDownloadPrioritizationFIFO` by default.
*/
@property (nonatomic, assign) AFImageDownloadPrioritization downloadPrioritizaton;
/**
The shared default instance of `AFImageDownloader` initialized with default values.
*/
+ (instancetype)defaultInstance;
/**
Creates a default `NSURLCache` with common usage parameter values.
@returns The default `NSURLCache` instance.
*/
+ (NSURLCache *)defaultURLCache;
/**
Default initializer
@return An instance of `AFImageDownloader` initialized with default values.
*/
- (instancetype)init;
/**
Initializes the `AFImageDownloader` instance with the given session manager, download prioritization, maximum active download count and image cache.
@param sessionManager The session manager to use to download images.
@param downloadPrioritization The download prioritization of the download queue.
@param maximumActiveDownloads The maximum number of active downloads allowed at any given time. Recommend `4`.
@param imageCache The image cache used to store all downloaded images in.
@return The new `AFImageDownloader` instance.
*/
- (instancetype)initWithSessionManager:(AFHTTPSessionManager *)sessionManager
downloadPrioritization:(AFImageDownloadPrioritization)downloadPrioritization
maximumActiveDownloads:(NSInteger)maximumActiveDownloads
imageCache:(nullable id <AFImageRequestCache>)imageCache;
/**
Creates a data task using the `sessionManager` instance for the specified URL request.
If the same data task is already in the queue or currently being downloaded, the success and failure blocks are
appended to the already existing task. Once the task completes, all success or failure blocks attached to the
task are executed in the order they were added.
@param request The URL request.
@param success A block to be executed when the image data task finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the response parameter will be `nil`.
@param failure A block object to be executed when the image data task finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred.
@return The image download receipt for the data task if available. `nil` if the image is stored in the cache.
cache and the URL request cache policy allows the cache to be used.
*/
- (nullable AFImageDownloadReceipt *)downloadImageForURLRequest:(NSURLRequest *)request
success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *responseObject))success
failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure;
/**
Creates a data task using the `sessionManager` instance for the specified URL request.
If the same data task is already in the queue or currently being downloaded, the success and failure blocks are
appended to the already existing task. Once the task completes, all success or failure blocks attached to the
task are executed in the order they were added.
@param request The URL request.
@param receiptID The identifier to use for the download receipt that will be created for this request. This must be a unique identifier that does not represent any other request.
@param success A block to be executed when the image data task finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the response parameter will be `nil`.
@param failure A block object to be executed when the image data task finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred.
@return The image download receipt for the data task if available. `nil` if the image is stored in the cache.
cache and the URL request cache policy allows the cache to be used.
*/
- (nullable AFImageDownloadReceipt *)downloadImageForURLRequest:(NSURLRequest *)request
withReceiptID:(NSUUID *)receiptID
success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *responseObject))success
failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure;
/**
Cancels the data task in the receipt by removing the corresponding success and failure blocks and cancelling the data task if necessary.
If the data task is pending in the queue, it will be cancelled if no other success and failure blocks are registered with the data task. If the data task is currently executing or is already completed, the success and failure blocks are removed and will not be called when the task finishes.
@param imageDownloadReceipt The image download receipt to cancel.
*/
- (void)cancelTaskForImageDownloadReceipt:(AFImageDownloadReceipt *)imageDownloadReceipt;
@end
#endif
NS_ASSUME_NONNULL_END
// AFNetworkActivityIndicatorManager.h
// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
#import <TargetConditionals.h>
#if TARGET_OS_IOS
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/**
`AFNetworkActivityIndicatorManager` manages the state of the network activity indicator in the status bar. When enabled, it will listen for notifications indicating that a session task has started or finished, and start or stop animating the indicator accordingly. The number of active requests is incremented and decremented much like a stack or a semaphore, and the activity indicator will animate so long as that number is greater than zero.
You should enable the shared instance of `AFNetworkActivityIndicatorManager` when your application finishes launching. In `AppDelegate application:didFinishLaunchingWithOptions:` you can do so with the following code:
[[AFNetworkActivityIndicatorManager sharedManager] setEnabled:YES];
By setting `enabled` to `YES` for `sharedManager`, the network activity indicator will show and hide automatically as requests start and finish. You should not ever need to call `incrementActivityCount` or `decrementActivityCount` yourself.
See the Apple Human Interface Guidelines section about the Network Activity Indicator for more information:
http://developer.apple.com/library/iOS/#documentation/UserExperience/Conceptual/MobileHIG/UIElementGuidelines/UIElementGuidelines.html#//apple_ref/doc/uid/TP40006556-CH13-SW44
*/
NS_EXTENSION_UNAVAILABLE_IOS("Use view controller based solutions where appropriate instead.")
@interface AFNetworkActivityIndicatorManager : NSObject
/**
A Boolean value indicating whether the manager is enabled.
If YES, the manager will change status bar network activity indicator according to network operation notifications it receives. The default value is NO.
*/
@property (nonatomic, assign, getter = isEnabled) BOOL enabled;
/**
A Boolean value indicating whether the network activity indicator manager is currently active.
*/
@property (readonly, nonatomic, assign, getter=isNetworkActivityIndicatorVisible) BOOL networkActivityIndicatorVisible;
/**
A time interval indicating the minimum duration of networking activity that should occur before the activity indicator is displayed. The default value 1 second. If the network activity indicator should be displayed immediately when network activity occurs, this value should be set to 0 seconds.
Apple's HIG describes the following:
> Display the network activity indicator to provide feedback when your app accesses the network for more than a couple of seconds. If the operation finishes sooner than that, you don’t have to show the network activity indicator, because the indicator is likely to disappear before users notice its presence.
*/
@property (nonatomic, assign) NSTimeInterval activationDelay;
/**
A time interval indicating the duration of time of no networking activity required before the activity indicator is disabled. This allows for continuous display of the network activity indicator across multiple requests. The default value is 0.17 seconds.
*/
@property (nonatomic, assign) NSTimeInterval completionDelay;
/**
Returns the shared network activity indicator manager object for the system.
@return The systemwide network activity indicator manager.
*/
+ (instancetype)sharedManager;
/**
Increments the number of active network requests. If this number was zero before incrementing, this will start animating the status bar network activity indicator.
*/
- (void)incrementActivityCount;
/**
Decrements the number of active network requests. If this number becomes zero after decrementing, this will stop animating the status bar network activity indicator.
*/
- (void)decrementActivityCount;
/**
Set the a custom method to be executed when the network activity indicator manager should be hidden/shown. By default, this is null, and the UIApplication Network Activity Indicator will be managed automatically. If this block is set, it is the responsiblity of the caller to manager the network activity indicator going forward.
@param block A block to be executed when the network activity indicator status changes.
*/
- (void)setNetworkingActivityActionWithBlock:(nullable void (^)(BOOL networkActivityIndicatorVisible))block;
@end
NS_ASSUME_NONNULL_END
#endif
// AFNetworkReachabilityManager.h
// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
#if !TARGET_OS_WATCH
#import <SystemConfiguration/SystemConfiguration.h>
typedef NS_ENUM(NSInteger, AFNetworkReachabilityStatus) {
AFNetworkReachabilityStatusUnknown = -1,
AFNetworkReachabilityStatusNotReachable = 0,
AFNetworkReachabilityStatusReachableViaWWAN = 1,
AFNetworkReachabilityStatusReachableViaWiFi = 2,
};
NS_ASSUME_NONNULL_BEGIN
/**
`AFNetworkReachabilityManager` monitors the reachability of domains, and addresses for both WWAN and WiFi network interfaces.
Reachability can be used to determine background information about why a network operation failed, or to trigger a network operation retrying when a connection is established. It should not be used to prevent a user from initiating a network request, as it's possible that an initial request may be required to establish reachability.
See Apple's Reachability Sample Code ( https://developer.apple.com/library/ios/samplecode/reachability/ )
@warning Instances of `AFNetworkReachabilityManager` must be started with `-startMonitoring` before reachability status can be determined.
*/
@interface AFNetworkReachabilityManager : NSObject
/**
The current network reachability status.
*/
@property (readonly, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus;
/**
Whether or not the network is currently reachable.
*/
@property (readonly, nonatomic, assign, getter = isReachable) BOOL reachable;
/**
Whether or not the network is currently reachable via WWAN.
*/
@property (readonly, nonatomic, assign, getter = isReachableViaWWAN) BOOL reachableViaWWAN;
/**
Whether or not the network is currently reachable via WiFi.
*/
@property (readonly, nonatomic, assign, getter = isReachableViaWiFi) BOOL reachableViaWiFi;
///---------------------
/// @name Initialization
///---------------------
/**
Returns the shared network reachability manager.
*/
+ (instancetype)sharedManager;
/**
Creates and returns a network reachability manager with the default socket address.
@return An initialized network reachability manager, actively monitoring the default socket address.
*/
+ (instancetype)manager;
/**
Creates and returns a network reachability manager for the specified domain.
@param domain The domain used to evaluate network reachability.
@return An initialized network reachability manager, actively monitoring the specified domain.
*/
+ (instancetype)managerForDomain:(NSString *)domain;
/**
Creates and returns a network reachability manager for the socket address.
@param address The socket address (`sockaddr_in6`) used to evaluate network reachability.
@return An initialized network reachability manager, actively monitoring the specified socket address.
*/
+ (instancetype)managerForAddress:(const void *)address;
/**
Initializes an instance of a network reachability manager from the specified reachability object.
@param reachability The reachability object to monitor.
@return An initialized network reachability manager, actively monitoring the specified reachability.
*/
- (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability NS_DESIGNATED_INITIALIZER;
///--------------------------------------------------
/// @name Starting & Stopping Reachability Monitoring
///--------------------------------------------------
/**
Starts monitoring for changes in network reachability status.
*/
- (void)startMonitoring;
/**
Stops monitoring for changes in network reachability status.
*/
- (void)stopMonitoring;
///-------------------------------------------------
/// @name Getting Localized Reachability Description
///-------------------------------------------------
/**
Returns a localized string representation of the current network reachability status.
*/
- (NSString *)localizedNetworkReachabilityStatusString;
///---------------------------------------------------
/// @name Setting Network Reachability Change Callback
///---------------------------------------------------
/**
Sets a callback to be executed when the network availability of the `baseURL` host changes.
@param block A block object to be executed when the network availability of the `baseURL` host changes.. This block has no return value and takes a single argument which represents the various reachability states from the device to the `baseURL`.
*/
- (void)setReachabilityStatusChangeBlock:(nullable void (^)(AFNetworkReachabilityStatus status))block;
@end
///----------------
/// @name Constants
///----------------
/**
## Network Reachability
The following constants are provided by `AFNetworkReachabilityManager` as possible network reachability statuses.
enum {
AFNetworkReachabilityStatusUnknown,
AFNetworkReachabilityStatusNotReachable,
AFNetworkReachabilityStatusReachableViaWWAN,
AFNetworkReachabilityStatusReachableViaWiFi,
}
`AFNetworkReachabilityStatusUnknown`
The `baseURL` host reachability is not known.
`AFNetworkReachabilityStatusNotReachable`
The `baseURL` host cannot be reached.
`AFNetworkReachabilityStatusReachableViaWWAN`
The `baseURL` host can be reached via a cellular connection, such as EDGE or GPRS.
`AFNetworkReachabilityStatusReachableViaWiFi`
The `baseURL` host can be reached via a Wi-Fi connection.
### Keys for Notification UserInfo Dictionary
Strings that are used as keys in a `userInfo` dictionary in a network reachability status change notification.
`AFNetworkingReachabilityNotificationStatusItem`
A key in the userInfo dictionary in a `AFNetworkingReachabilityDidChangeNotification` notification.
The corresponding value is an `NSNumber` object representing the `AFNetworkReachabilityStatus` value for the current reachability status.
*/
///--------------------
/// @name Notifications
///--------------------
/**
Posted when network reachability changes.
This notification assigns no notification object. The `userInfo` dictionary contains an `NSNumber` object under the `AFNetworkingReachabilityNotificationStatusItem` key, representing the `AFNetworkReachabilityStatus` value for the current network reachability.
@warning In order for network reachability to be monitored, include the `SystemConfiguration` framework in the active target's "Link Binary With Library" build phase, and add `#import <SystemConfiguration/SystemConfiguration.h>` to the header prefix of the project (`Prefix.pch`).
*/
FOUNDATION_EXPORT NSString * const AFNetworkingReachabilityDidChangeNotification;
FOUNDATION_EXPORT NSString * const AFNetworkingReachabilityNotificationStatusItem;
///--------------------
/// @name Functions
///--------------------
/**
Returns a localized string representation of an `AFNetworkReachabilityStatus` value.
*/
FOUNDATION_EXPORT NSString * AFStringFromNetworkReachabilityStatus(AFNetworkReachabilityStatus status);
NS_ASSUME_NONNULL_END
#endif
// AFNetworking.h
//
// Copyright (c) 2013 AFNetworking (http://afnetworking.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
#import <Availability.h>
#import <TargetConditionals.h>
#ifndef _AFNETWORKING_
#define _AFNETWORKING_
#import "AFURLRequestSerialization.h"
#import "AFURLResponseSerialization.h"
#import "AFSecurityPolicy.h"
#if !TARGET_OS_WATCH
#import "AFNetworkReachabilityManager.h"
#endif
#import "AFURLSessionManager.h"
#import "AFHTTPSessionManager.h"
#endif /* _AFNETWORKING_ */
// AFSecurityPolicy.h
// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
#import <Security/Security.h>
typedef NS_ENUM(NSUInteger, AFSSLPinningMode) {
AFSSLPinningModeNone,
AFSSLPinningModePublicKey,
AFSSLPinningModeCertificate,
};
/**
`AFSecurityPolicy` evaluates server trust against pinned X.509 certificates and public keys over secure connections.
Adding pinned SSL certificates to your app helps prevent man-in-the-middle attacks and other vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged to route all communication over an HTTPS connection with SSL pinning configured and enabled.
*/
NS_ASSUME_NONNULL_BEGIN
@interface AFSecurityPolicy : NSObject <NSSecureCoding, NSCopying>
/**
The criteria by which server trust should be evaluated against the pinned SSL certificates. Defaults to `AFSSLPinningModeNone`.
*/
@property (readonly, nonatomic, assign) AFSSLPinningMode SSLPinningMode;
/**
The certificates used to evaluate server trust according to the SSL pinning mode.
By default, this property is set to any (`.cer`) certificates included in the target compiling AFNetworking. Note that if you are using AFNetworking as embedded framework, no certificates will be pinned by default. Use `certificatesInBundle` to load certificates from your target, and then create a new policy by calling `policyWithPinningMode:withPinnedCertificates`.
Note that if pinning is enabled, `evaluateServerTrust:forDomain:` will return true if any pinned certificate matches.
*/
@property (nonatomic, strong, nullable) NSSet <NSData *> *pinnedCertificates;
/**
Whether or not to trust servers with an invalid or expired SSL certificates. Defaults to `NO`.
*/
@property (nonatomic, assign) BOOL allowInvalidCertificates;
/**
Whether or not to validate the domain name in the certificate's CN field. Defaults to `YES`.
*/
@property (nonatomic, assign) BOOL validatesDomainName;
///-----------------------------------------
/// @name Getting Certificates from the Bundle
///-----------------------------------------
/**
Returns any certificates included in the bundle. If you are using AFNetworking as an embedded framework, you must use this method to find the certificates you have included in your app bundle, and use them when creating your security policy by calling `policyWithPinningMode:withPinnedCertificates`.
@return The certificates included in the given bundle.
*/
+ (NSSet <NSData *> *)certificatesInBundle:(NSBundle *)bundle;
///-----------------------------------------
/// @name Getting Specific Security Policies
///-----------------------------------------
/**
Returns the shared default security policy, which does not allow invalid certificates, validates domain name, and does not validate against pinned certificates or public keys.
@return The default security policy.
*/
+ (instancetype)defaultPolicy;
///---------------------
/// @name Initialization
///---------------------
/**
Creates and returns a security policy with the specified pinning mode.
@param pinningMode The SSL pinning mode.
@return A new security policy.
*/
+ (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode;
/**
Creates and returns a security policy with the specified pinning mode.
@param pinningMode The SSL pinning mode.
@param pinnedCertificates The certificates to pin against.
@return A new security policy.
*/
+ (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode withPinnedCertificates:(NSSet <NSData *> *)pinnedCertificates;
///------------------------------
/// @name Evaluating Server Trust
///------------------------------
/**
Whether or not the specified server trust should be accepted, based on the security policy.
This method should be used when responding to an authentication challenge from a server.
@param serverTrust The X.509 certificate trust of the server.
@param domain The domain of serverTrust. If `nil`, the domain will not be validated.
@return Whether or not to trust the server.
*/
- (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust
forDomain:(nullable NSString *)domain;
@end
NS_ASSUME_NONNULL_END
///----------------
/// @name Constants
///----------------
/**
## SSL Pinning Modes
The following constants are provided by `AFSSLPinningMode` as possible SSL pinning modes.
enum {
AFSSLPinningModeNone,
AFSSLPinningModePublicKey,
AFSSLPinningModeCertificate,
}
`AFSSLPinningModeNone`
Do not used pinned certificates to validate servers.
`AFSSLPinningModePublicKey`
Validate host certificates against public keys of pinned certificates.
`AFSSLPinningModeCertificate`
Validate host certificates against pinned certificates.
*/
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
//
// IQBarButtonItem.h
// https://github.com/hackiftekhar/IQKeyboardManager
// Copyright (c) 2013-16 Iftekhar Qurashi.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UIBarButtonItem.h>
/**
IQBarButtonItem used for IQToolbar.
*/
@interface IQBarButtonItem : UIBarButtonItem
@end
This diff is collapsed.
//
// IQKeyboardManagerConstants.h
// https://github.com/hackiftekhar/IQKeyboardManager
// Copyright (c) 2013-16 Iftekhar Qurashi.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#ifndef IQKeyboardManagerConstants_h
#define IQKeyboardManagerConstants_h
#import <Foundation/NSObjCRuntime.h>
///-----------------------------------
/// @name IQAutoToolbarManageBehaviour
///-----------------------------------
/**
`IQAutoToolbarBySubviews`
Creates Toolbar according to subview's hirarchy of Textfield's in view.
`IQAutoToolbarByTag`
Creates Toolbar according to tag property of TextField's.
`IQAutoToolbarByPosition`
Creates Toolbar according to the y,x position of textField in it's superview coordinate.
*/
typedef NS_ENUM(NSInteger, IQAutoToolbarManageBehaviour) {
IQAutoToolbarBySubviews,
IQAutoToolbarByTag,
IQAutoToolbarByPosition,
};
///-------------------
/// @name Localization
///-------------------
#define IQLocalizedString(key, comment) [[NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"IQKeyboardManager" ofType:@"bundle"]] localizedStringForKey:(key) value:@"" table:@"IQKeyboardManager"]
#endif
/*
/---------------------------------------------------------------------------------------------------\
\---------------------------------------------------------------------------------------------------/
| iOS NSNotification Mechanism |
/---------------------------------------------------------------------------------------------------\
\---------------------------------------------------------------------------------------------------/
------------------------------------------------------------
When UITextField become first responder
------------------------------------------------------------
- UITextFieldTextDidBeginEditingNotification (UITextField)
- UIKeyboardWillShowNotification
- UIKeyboardDidShowNotification
------------------------------------------------------------
When UITextView become first responder
------------------------------------------------------------
- UIKeyboardWillShowNotification
- UITextViewTextDidBeginEditingNotification (UITextView)
- UIKeyboardDidShowNotification
------------------------------------------------------------
When switching focus from UITextField to another UITextField
------------------------------------------------------------
- UITextFieldTextDidEndEditingNotification (UITextField1)
- UITextFieldTextDidBeginEditingNotification (UITextField2)
- UIKeyboardWillShowNotification
- UIKeyboardDidShowNotification
------------------------------------------------------------
When switching focus from UITextView to another UITextView
------------------------------------------------------------
- UITextViewTextDidEndEditingNotification : (UITextView1)
- UIKeyboardWillShowNotification
- UITextViewTextDidBeginEditingNotification : (UITextView2)
- UIKeyboardDidShowNotification
------------------------------------------------------------
When switching focus from UITextField to UITextView
------------------------------------------------------------
- UITextFieldTextDidEndEditingNotification (UITextField)
- UIKeyboardWillShowNotification
- UITextViewTextDidBeginEditingNotification (UITextView)
- UIKeyboardDidShowNotification
------------------------------------------------------------
When switching focus from UITextView to UITextField
------------------------------------------------------------
- UITextViewTextDidEndEditingNotification (UITextView)
- UITextFieldTextDidBeginEditingNotification (UITextField)
- UIKeyboardWillShowNotification
- UIKeyboardDidShowNotification
------------------------------------------------------------
When opening/closing UIKeyboard Predictive bar
------------------------------------------------------------
- UIKeyboardWillShowNotification
- UIKeyboardDidShowNotification
------------------------------------------------------------
On orientation change
------------------------------------------------------------
- UIApplicationWillChangeStatusBarOrientationNotification
- UIKeyboardWillHideNotification
- UIKeyboardDidHideNotification
- UIApplicationDidChangeStatusBarOrientationNotification
- UIKeyboardWillShowNotification
- UIKeyboardDidShowNotification
- UIKeyboardWillShowNotification
- UIKeyboardDidShowNotification
*/
//
// IQKeyboardManagerConstantsInternal.h
// https://github.com/hackiftekhar/IQKeyboardManager
// Copyright (c) 2013-16 Iftekhar Qurashi.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#ifndef IQKeyboardManagerConstantsInternal_h
#define IQKeyboardManagerConstantsInternal_h
///-----------------------------------
/// @name IQLayoutGuidePosition
///-----------------------------------
/**
`IQLayoutGuidePositionNone`
If there are no IQLayoutGuideConstraint associated with viewController
`IQLayoutGuidePositionTop`
If provided IQLayoutGuideConstraint is associated with with viewController topLayoutGuide
`IQLayoutGuidePositionBottom`
If provided IQLayoutGuideConstraint is associated with with viewController bottomLayoutGuide
*/
typedef NS_ENUM(NSInteger, IQLayoutGuidePosition) {
IQLayoutGuidePositionNone,
IQLayoutGuidePositionTop,
IQLayoutGuidePositionBottom,
};
//Xcode 8 compatibility check
#ifdef NSFoundationVersionNumber_iOS_9_x_Max
#define IQ_IS_IOS10_OR_GREATER (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_9_x_Max)
#else
#define IQ_IS_IOS10_OR_GREATER NO
#endif
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment