Commit 4441eae2 authored by 曹云霄's avatar 曹云霄

工单详情界面的子工单列表只显示isEditable 为true的数据

parent e7f11098
......@@ -18,6 +18,13 @@
294B8642201974930035BF32 /* PermissionsManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 294B8641201974930035BF32 /* PermissionsManager.swift */; };
294B8646201AECAD0035BF32 /* ProjectQueryModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 294B8645201AECAC0035BF32 /* ProjectQueryModel.swift */; };
294B8648201AF2DB0035BF32 /* ProjectResultModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 294B8647201AF2DB0035BF32 /* ProjectResultModel.swift */; };
294BE7FF2080431500F783F8 /* YXAddressPickerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 294BE7F32080431500F783F8 /* YXAddressPickerView.m */; };
294BE8002080431500F783F8 /* YXBundle.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 294BE7F42080431500F783F8 /* YXBundle.bundle */; };
294BE8012080431500F783F8 /* YXCityModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 294BE7F62080431500F783F8 /* YXCityModel.m */; };
294BE8022080431500F783F8 /* YXDatePickerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 294BE7F82080431500F783F8 /* YXDatePickerView.m */; };
294BE8032080431500F783F8 /* YXGeneralPickerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 294BE7FA2080431500F783F8 /* YXGeneralPickerView.m */; };
294BE8042080431500F783F8 /* YXPickerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 294BE7FC2080431500F783F8 /* YXPickerManager.m */; };
294BE8052080431500F783F8 /* YXToolbar.m in Sources */ = {isa = PBXBuildFile; fileRef = 294BE7FE2080431500F783F8 /* YXToolbar.m */; };
295064B7200C9E50008DC8DD /* AttachmentReponseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 295064B6200C9E4F008DC8DD /* AttachmentReponseModel.swift */; };
295064B9200CAA6B008DC8DD /* AttachmentResultModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 295064B8200CAA6B008DC8DD /* AttachmentResultModel.swift */; };
295064BB200CC7F5008DC8DD /* ChildBillSaveOrUpdateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 295064BA200CC7F5008DC8DD /* ChildBillSaveOrUpdateModel.swift */; };
......@@ -158,6 +165,19 @@
294B8641201974930035BF32 /* PermissionsManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PermissionsManager.swift; sourceTree = "<group>"; };
294B8645201AECAC0035BF32 /* ProjectQueryModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProjectQueryModel.swift; sourceTree = "<group>"; };
294B8647201AF2DB0035BF32 /* ProjectResultModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProjectResultModel.swift; sourceTree = "<group>"; };
294BE7F22080431500F783F8 /* YXAddressPickerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YXAddressPickerView.h; sourceTree = "<group>"; };
294BE7F32080431500F783F8 /* YXAddressPickerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YXAddressPickerView.m; sourceTree = "<group>"; };
294BE7F42080431500F783F8 /* YXBundle.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = YXBundle.bundle; sourceTree = "<group>"; };
294BE7F52080431500F783F8 /* YXCityModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YXCityModel.h; sourceTree = "<group>"; };
294BE7F62080431500F783F8 /* YXCityModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YXCityModel.m; sourceTree = "<group>"; };
294BE7F72080431500F783F8 /* YXDatePickerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YXDatePickerView.h; sourceTree = "<group>"; };
294BE7F82080431500F783F8 /* YXDatePickerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YXDatePickerView.m; sourceTree = "<group>"; };
294BE7F92080431500F783F8 /* YXGeneralPickerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YXGeneralPickerView.h; sourceTree = "<group>"; };
294BE7FA2080431500F783F8 /* YXGeneralPickerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YXGeneralPickerView.m; sourceTree = "<group>"; };
294BE7FB2080431500F783F8 /* YXPickerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YXPickerManager.h; sourceTree = "<group>"; };
294BE7FC2080431500F783F8 /* YXPickerManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YXPickerManager.m; sourceTree = "<group>"; };
294BE7FD2080431500F783F8 /* YXToolbar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YXToolbar.h; sourceTree = "<group>"; };
294BE7FE2080431500F783F8 /* YXToolbar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YXToolbar.m; sourceTree = "<group>"; };
295064B6200C9E4F008DC8DD /* AttachmentReponseModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AttachmentReponseModel.swift; sourceTree = "<group>"; };
295064B8200CAA6B008DC8DD /* AttachmentResultModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AttachmentResultModel.swift; sourceTree = "<group>"; };
295064BA200CC7F5008DC8DD /* ChildBillSaveOrUpdateModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChildBillSaveOrUpdateModel.swift; sourceTree = "<group>"; };
......@@ -314,6 +334,26 @@
path = Permissions;
sourceTree = "<group>";
};
294BE7F12080431500F783F8 /* YXPickerView */ = {
isa = PBXGroup;
children = (
294BE7F22080431500F783F8 /* YXAddressPickerView.h */,
294BE7F32080431500F783F8 /* YXAddressPickerView.m */,
294BE7F42080431500F783F8 /* YXBundle.bundle */,
294BE7F52080431500F783F8 /* YXCityModel.h */,
294BE7F62080431500F783F8 /* YXCityModel.m */,
294BE7F72080431500F783F8 /* YXDatePickerView.h */,
294BE7F82080431500F783F8 /* YXDatePickerView.m */,
294BE7F92080431500F783F8 /* YXGeneralPickerView.h */,
294BE7FA2080431500F783F8 /* YXGeneralPickerView.m */,
294BE7FB2080431500F783F8 /* YXPickerManager.h */,
294BE7FC2080431500F783F8 /* YXPickerManager.m */,
294BE7FD2080431500F783F8 /* YXToolbar.h */,
294BE7FE2080431500F783F8 /* YXToolbar.m */,
);
path = YXPickerView;
sourceTree = "<group>";
};
296AAC951FFDF462008BE04C /* SearchVc */ = {
isa = PBXGroup;
children = (
......@@ -763,6 +803,7 @@
29EA0BC31FEA3156005A6170 /* Vender */ = {
isa = PBXGroup;
children = (
294BE7F12080431500F783F8 /* YXPickerView */,
29B0C6681FEA382F00FF37ED /* MBProgressView */,
);
path = Vender;
......@@ -1040,6 +1081,7 @@
29B0C66C1FEA3A7000FF37ED /* LaunchScreen.storyboard in Resources */,
296FE4581FFB7CED00810820 /* function.plist in Resources */,
29516A92200DEE9500C3A17E /* RepairOrderAttachmentTableViewCell.xib in Resources */,
294BE8002080431500F783F8 /* YXBundle.bundle in Resources */,
29516A8A200DEC4400C3A17E /* MaintainBeforAttachmentTableViewCell.xib in Resources */,
29516A8E200DEC5A00C3A17E /* MaintainAfterAttachmentTableViewCell.xib in Resources */,
29DA416A200334BC002762A2 /* RepairOrderSubOrderTableViewCell.xib in Resources */,
......@@ -1083,7 +1125,6 @@
"${BUILT_PRODUCTS_DIR}/SwiftyJSON/SwiftyJSON.framework",
"${BUILT_PRODUCTS_DIR}/YXAlertController/YXAlertController.framework",
"${BUILT_PRODUCTS_DIR}/YXKit/YXKit.framework",
"${BUILT_PRODUCTS_DIR}/YXPickerView/YXPickerView.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
......@@ -1108,7 +1149,6 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyJSON.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YXAlertController.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YXKit.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YXPickerView.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
......@@ -1184,12 +1224,15 @@
29B0C66A1FEA382F00FF37ED /* MBProgressView.swift in Sources */,
296DAD7E2006FBEB00615A2D /* RepairOrderAddViewModel.swift in Sources */,
29EA0C0B1FEA3156005A6170 /* Public.swift in Sources */,
294BE8022080431500F783F8 /* YXDatePickerView.m in Sources */,
294BE8042080431500F783F8 /* YXPickerManager.m in Sources */,
29516A91200DEE9500C3A17E /* RepairOrderAttachmentTableViewCell.swift in Sources */,
296AAC9F1FFDF54A008BE04C /* FilterTableViewCell.swift in Sources */,
29DA416C2003419A002762A2 /* RepairOrderDetailSuspendView.swift in Sources */,
29F6B8EE2007498A00EE4630 /* DeviceQueryModel.swift in Sources */,
296968062007142B0049B5CC /* PublicFilterModel.swift in Sources */,
29DA417A200367EF002762A2 /* RepairOrderEditSonOrderCompleteView.swift in Sources */,
294BE8032080431500F783F8 /* YXGeneralPickerView.m in Sources */,
29CD9D9F20562CB200BB7C8D /* TenantResultModel.swift in Sources */,
29D530931FFF715D00851F00 /* PhotoAttachmentViewModel.swift in Sources */,
296DAD7C2006F63B00615A2D /* ProjectSponsorsModel.swift in Sources */,
......@@ -1211,6 +1254,7 @@
296DAD82200711CA00615A2D /* InitiatorModel.swift in Sources */,
29EA0C011FEA3156005A6170 /* BaseColletionViewPullController.swift in Sources */,
29D530801FFF626500851F00 /* RepairOrderViewController.swift in Sources */,
294BE7FF2080431500F783F8 /* YXAddressPickerView.m in Sources */,
29D530911FFF6FA800851F00 /* PhotoAttachmentViewController.swift in Sources */,
29DA41662003163D002762A2 /* RepairOrderDetailSectionView.swift in Sources */,
295064B7200C9E50008DC8DD /* AttachmentReponseModel.swift in Sources */,
......@@ -1236,8 +1280,10 @@
296FE44A1FFB5C9600810820 /* HomeContentViewController.swift in Sources */,
29D530861FFF628A00851F00 /* TodoViewController.swift in Sources */,
29EA0BFC1FEA3156005A6170 /* AppManager.swift in Sources */,
294BE8052080431500F783F8 /* YXToolbar.m in Sources */,
29DA4180200373C3002762A2 /* LoginViewModel.swift in Sources */,
29696808200728F50049B5CC /* QueryModel.swift in Sources */,
294BE8012080431500F783F8 /* YXCityModel.m in Sources */,
296FE44C1FFB5CAB00810820 /* HomeTableViewController.swift in Sources */,
29EA0C131FEA3156005A6170 /* UIView+Extension.swift in Sources */,
29D5308A1FFF635C00851F00 /* TodoViewModel.swift in Sources */,
......
......@@ -99,7 +99,11 @@ class BaseTableViewPullController: BaseViewController {
tableView.reloadData()
if tableView.isEmptyDataSetVisible {
tableView.reloadEmptyDataSet()
} }
tableView.mj_footer.isHidden = true
}else {
tableView.mj_footer.isHidden = false
}
}
// MARK: - 结束刷新切显示无更多的数据
func endRefreshNomoreData() {
......
......@@ -148,7 +148,7 @@ public func repairOrderChineseState(_ state: String) ->String {
case SUBMIT_REPAIR_ORDER_STATE.CREATED.rawValue:
return "未发出"
case SUBMIT_REPAIR_ORDER_STATE.SUBMIT.rawValue:
return "已发出"
return "未派单"
case SUBMIT_REPAIR_ORDER_STATE.PROCESSING.rawValue:
return "处理中"
case SUBMIT_REPAIR_ORDER_STATE.FINISHED.rawValue:
......@@ -177,7 +177,7 @@ public func repairOrderEnglishState(_ state: String) ->String {
switch state {
case "未发出":
return SUBMIT_REPAIR_ORDER_STATE.CREATED.rawValue
case "已发出":
case "未派单":
return SUBMIT_REPAIR_ORDER_STATE.SUBMIT.rawValue
case "处理中":
return SUBMIT_REPAIR_ORDER_STATE.PROCESSING.rawValue
......
......@@ -14,12 +14,12 @@ import Foundation
//public let BaseAttachmentUrl: String = "http://192.168.1.176:9030"
//测试环境
public let BaseUrl: String = "http://222.180.250.18:7080/ifs-server/rest"
public let BaseAttachmentUrl: String = "http://222.180.250.18:7080"
//public let BaseUrl: String = "http://222.180.250.18:7080/ifs-server/rest"
//public let BaseAttachmentUrl: String = "http://222.180.250.18:7080"
//外网开发环境
//public let BaseUrl: String = "http://dev.gomoretech.com/ifs-server/rest"
//public let BaseAttachmentUrl: String = "http://dev.gomoretech.com"
public let BaseUrl: String = "http://dev.gomoretech.com/ifs-server/rest"
public let BaseAttachmentUrl: String = "http://dev.gomoretech.com"
/// 登录
public let loginUrl: String = "/user/login/%@"
......
......@@ -136,7 +136,9 @@ open class BillDetailData : NSObject{
let executesArray = json["executes"].arrayValue
for executesJson in executesArray{
let value = BillDetailExecute(fromJson: executesJson)
executes.append(value)
if value.isEditable {
executes.append(value)
}
}
feedback = json["feedback"].stringValue
feedbackNote = json["feedbackNote"].stringValue
......
......@@ -109,23 +109,23 @@ extension RepairOrderDetailViewModel {
// MARK: - 查询工单转交部门
func queryRepairOrderDepartmentAction(_ model: QueryModel) ->Observable<DepartmentData> {
if AppManager.shareInstance.userStoreModel != nil {
// if AppManager.shareInstance.userStoreModel != nil {
return queryRepairOrderDepartmentAction2()
}else {
return Observable.create({ (observer) -> Disposable in
Network.request(target: .GetRepairOrderDepartment(model), success: { (json) in
let resultModel = DepartmentResultModel(fromJson: json)
if resultModel.success {
observer.onNext(resultModel.data)
}else {
ShowMessage(resultModel.message)
}
}, failure: { (error) in
ShowMessage(error.localizedDescription)
})
return Disposables.create()
})
}
// }else {
// return Observable.create({ (observer) -> Disposable in
// Network.request(target: .GetRepairOrderDepartment(model), success: { (json) in
// let resultModel = DepartmentResultModel(fromJson: json)
// if resultModel.success {
// observer.onNext(resultModel.data)
// }else {
// ShowMessage(resultModel.message)
// }
// }, failure: { (error) in
// ShowMessage(error.localizedDescription)
// })
// return Disposables.create()
// })
// }
}
// MARK: - 查询工单转交部门2(当前登录人所属项目不为空时调用)
......
......@@ -115,7 +115,7 @@ extension RepairOrderViewModel {
})
break
case REPAIR_ORDER_FILTER_BUTTON_TAG.STATE.rawValue:
YXPickerManager.share().showGeneralPickerView(kNavColor, dataArray: ["全部状态","未发出","已发出","处理中","已完成","已删除","已作废"], defaultString: sender.currentTitle, commit: { (text, index) in
YXPickerManager.share().showGeneralPickerView(kNavColor, dataArray: ["全部状态","未发出","未派单","处理中","已完成","已删除","已作废"], defaultString: sender.currentTitle, commit: { (text, index) in
sender.isSelected = false
sender.addBorder(1.0, kGaryColor)
sender.setTitle(text, for: .normal)
......
......@@ -54,7 +54,7 @@ class HomeTableViewController: BaseTableViewPullController {
default:
break
}
self?.tableView.reloadData()
self?.reloadData()
}.disposed(by: disposeBag)
}
......
......@@ -5,7 +5,7 @@
#import "UIImage+Category.h"
#import "UINavigationController+FDFullscreenPopGesture.h"
#import "YXKitHeader.h"
@import YXPickerView;
#import "YXPickerManager.h"
@import YXAlertController;
@import YXKit;
#import "IQTextView.h"
......
......@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.4</string>
<string>1.0.5</string>
<key>CFBundleVersion</key>
<string>1.0.4</string>
<string>1.0.5</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
......
//
// YXAddressPickerView.h
// YXAddressPickerView
//
// Created by 曹云霄 on 2017/7/14.
// Copyright © 2017年 曹云霄. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "YXToolbar.h"
@interface YXAddressPickerView : UIPickerView
@property (nonatomic, strong) YXToolbar *toolbar;
/**
显示省市区选择框
@param tintColor 主题颜色
@param address 默认地址
@param commitBlock 确认回调
@param cancelBlock 取消回调
*/
- (void)showAddressPickerView:(UIColor *)tintColor defaultAddress:(NSString *)address commitBlock:(void(^)(NSString *address,NSString *zipcode))commitBlock cancelBlock:(void(^)())cancelBlock;
@end
//
// YXAddressPickerView.m
// YXAddressPickerView
//
// Created by 曹云霄 on 2017/7/14.
// Copyright © 2017年 曹云霄. All rights reserved.
//
#import "YXAddressPickerView.h"
#import "YXCityModel.h"
/**
取消回调
*/
typedef void (^CancelBlock)();
@interface YXAddressPickerView()<UIPickerViewDelegate,UIPickerViewDataSource>
@property (nonatomic, strong) UIView *bgView;
@property (nonatomic, strong) UIView *containerView;
@property (nonatomic, strong) NSMutableArray *datasArray;
/**
选中省
*/
@property (nonatomic, assign) NSInteger selectedIndex_province;
/**
选中市
*/
@property (nonatomic, assign) NSInteger selectedIndex_city;
/**
选中区
*/
@property (nonatomic, assign) NSInteger selectedIndex_area;
@property (nonatomic, copy) CancelBlock block;
@end
@implementation YXAddressPickerView
#pragma mark -lazy
- (NSMutableArray *)datasArray
{
if (!_datasArray) {
_datasArray = [NSMutableArray array];
}
return _datasArray;
}
- (instancetype)initWithFrame:(CGRect)frame
{
[self initToolBar];
[self initContainerView];
CGRect initialFrame;
if (CGRectIsEmpty(frame)) {
initialFrame = CGRectMake(0, self.toolbar.frame.size.height, WIDTH, 216);
} else {
initialFrame = frame;
}
self = [super initWithFrame:initialFrame];
if (self) {
self.backgroundColor = [UIColor whiteColor];
self.delegate = self;
self.dataSource = self;
self.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[self initBgView];
[self getDatas];
}
return self;
}
- (void)initBgView
{
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, HEIGHT - self.frame.size.height - 44, WIDTH, self.frame.size.height + self.toolbar.frame.size.height)];
}
- (void)initToolBar
{
self.toolbar = [[YXToolbar alloc] initWithFrame:CGRectMake(0, 0, WIDTH, 44)];
self.toolbar.translucent = NO;
}
- (void)initContainerView
{
self.containerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)];
self.containerView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.4];
self.containerView.userInteractionEnabled = YES;
[self.containerView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hiddenWithAnimation)]];
}
- (void)showWithAnimation {
[self addViews];
self.containerView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.0];
CGFloat height = self.bgView.frame.size.height;
self.bgView.center = CGPointMake(WIDTH / 2, HEIGHT + height / 2);
[UIView animateWithDuration:0.25 animations:^{
self.bgView.center = CGPointMake(WIDTH / 2, HEIGHT - height / 2);
self.containerView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.4];
}];
}
- (void)hiddenWithAnimation {
self.block();
CGFloat height = self.bgView.frame.size.height;
[UIView animateWithDuration:0.25 animations:^{
self.bgView.center = CGPointMake(WIDTH / 2, HEIGHT + height / 2);
self.containerView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.0];
} completion:^(BOOL finished) {
[self hiddenViews];
}];
}
- (void)addViews {
UIWindow *window = [UIApplication sharedApplication].keyWindow;
[window addSubview:self.containerView];
[window addSubview:self.bgView];
[self.bgView addSubview:self.toolbar];
[self.bgView addSubview:self];
}
- (void)hiddenViews {
[self removeFromSuperview];
[self.toolbar removeFromSuperview];
[self.bgView removeFromSuperview];
[self.containerView removeFromSuperview];
}
#pragma mark -解析省市区JSON数据
- (void)getDatas
{
NSBundle *bundlePath = [NSBundle bundleWithPath:[[NSBundle bundleForClass:[YXAddressPickerView class]] pathForResource:@"YXBundle" ofType:@"bundle"]];
NSData *data = [NSData dataWithContentsOfFile:[bundlePath pathForResource:@"city" ofType:@"json"]];
NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:nil];
NSArray *provinceArray = dict[@"root"][@"province"];
for (NSDictionary *cityDict in provinceArray) {
YXCityModel *model = [[YXCityModel alloc] init];
[model setValuesForKeysWithDictionary:cityDict];
[self.datasArray addObject:model];
}
[self reloadAllComponents];
}
#pragma mark - 开始选择
- (void)showAddressPickerView:(UIColor *)tintColor defaultAddress:(NSString *)address commitBlock:(void (^)(NSString *, NSString *))commitBlock cancelBlock:(void (^)())cancelBlock
{
self.block = cancelBlock;
[self showDefaultAddress:address];
self.toolbar.tintColor = tintColor;
[self showWithAnimation];
__weak typeof(self) weakSelf = self;
self.toolbar.cancelBlock = ^ {
if (cancelBlock) {
[weakSelf hiddenWithAnimation];
}
};
self.toolbar.commitBlock = ^{
if (commitBlock) {
[weakSelf hiddenWithAnimation];
YXCityModel *model = weakSelf.datasArray[weakSelf.selectedIndex_province];
NSDictionary *dict = model.city[weakSelf.selectedIndex_city];
id object = dict[@"district"];
NSDictionary *dict1 = nil;
if ([object isKindOfClass:[NSDictionary class]]) {
dict1 = object;
}else {
dict1 = dict[@"district"][self.selectedIndex_area];
}
NSString *address = [NSString stringWithFormat:@"%@-%@-%@",model.name,dict[@"name"],dict1[@"name"]];
NSString *zipcode = [NSString stringWithFormat:@"%@-%@-%@",model.zipcode,dict[@"zipcode"],dict1[@"zipcode"]];
commitBlock(address, zipcode);
}
};
}
#pragma mark -显示默认地址
- (void)showDefaultAddress:(NSString *)address
{
if (!address) {
return;
}
NSArray *addressArray = [address componentsSeparatedByString:@"-"];
[self.datasArray enumerateObjectsUsingBlock:^(YXCityModel *obj, NSUInteger idx, BOOL * _Nonnull stop) {
if ([obj.name isEqualToString:addressArray.firstObject]) {
self.selectedIndex_province = idx;
[obj.city enumerateObjectsUsingBlock:^(NSDictionary *dict, NSUInteger idx, BOOL * _Nonnull stop) {
if ([dict[@"name"] isEqualToString:addressArray[1]]) {
self.selectedIndex_city = idx;
id object = dict[@"district"];
if ([object isKindOfClass:[NSDictionary class]]) {
self.selectedIndex_area = 0;
}else {
[object enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if ([obj[@"name"] isEqualToString:[addressArray lastObject]]) {
self.selectedIndex_area = idx;
*stop = YES;
}
}];
}
}
}];
}
}];
[self reloadComponent:0];
[self reloadComponent:1];
[self reloadComponent:2];
[self selectRow:self.selectedIndex_province inComponent:0 animated:NO];
[self selectRow:self.selectedIndex_city inComponent:1 animated:NO];
[self selectRow:self.selectedIndex_area inComponent:2 animated:NO];
}
#pragma mark -<UIPickerViewDelegate,UIPickerViewDataSource>
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
return 3;
}
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
switch (component) {
case 0:
{
YXCityModel *model = self.datasArray[row];
return model.name;
}
break;
case 1:
{
YXCityModel *model = self.datasArray[self.selectedIndex_province];
NSDictionary *dict = model.city[row];
return dict[@"name"];
}
break;
case 2:
{
YXCityModel *model = self.datasArray[self.selectedIndex_province];
NSDictionary *dict = model.city[self.selectedIndex_city];
id object = dict[@"district"];
if ([object isKindOfClass:[NSDictionary class]]) {
return object[@"name"];
}
NSDictionary *dict1 = dict[@"district"][row];
return dict1[@"name"];
}
break;
default:
break;
}
return @"";
}
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component;
{
switch (component) {
case 0:
{
return self.datasArray.count;
}
break;
case 1:
{
YXCityModel *model = self.datasArray[self.selectedIndex_province];
return model.city.count;
}
break;
case 2:
{
YXCityModel *model = self.datasArray[self.selectedIndex_province];
NSDictionary *dict = model.city[self.selectedIndex_city];
id object = dict[@"district"];
if ([object isKindOfClass:[NSDictionary class]]) {
return 1;
}
return [dict[@"district"] count];
}
break;
default:
break;
}
return 10;
}
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
switch (component) {
case 0:
self.selectedIndex_province = row;
self.selectedIndex_city = 0;
self.selectedIndex_area = 0;
[pickerView reloadComponent:1];
[pickerView reloadComponent:2];
[pickerView selectRow:0 inComponent:1 animated:NO];
[pickerView selectRow:0 inComponent:2 animated:NO];
break;
case 1:
self.selectedIndex_city = row;
self.selectedIndex_area = 0;
[pickerView reloadComponent:2];
[pickerView selectRow:0 inComponent:2 animated:NO];
break;
case 2:
self.selectedIndex_area = row;
break;
default:
break;
}
}
@end
This source diff could not be displayed because it is too large. You can view the blob instead.
//
// YXCityModel.h
// YXPickerView
//
// Created by 曹云霄 on 2017/7/14.
// Copyright © 2017年 曹云霄. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface YXCityModel : NSObject
@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *zipcode;
@property (nonatomic, strong) NSArray *city;
@end
//
// YXCityModel.m
// YXPickerView
//
// Created by 曹云霄 on 2017/7/14.
// Copyright © 2017年 曹云霄. All rights reserved.
//
#import "YXCityModel.h"
@implementation YXCityModel
@end
//
// YXDatePickerView.h
// demo
//
// Created by 曹云霄 on 2017/7/17.
// Copyright © 2017年 曹云霄. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "YXToolbar.h"
@interface YXDatePickerView : UIDatePicker
@property (nonatomic, strong) YXToolbar *toolbar;
/**
显示时间选择框
@param tintColor 主题颜色
@param model NSDate类型
@param minimumDate 最小时间
@param maximumDate 最大时间
@param dateString 默认时间字符串
@param commitBlock 确认回调
@param cancelBlock 取消回调
*/
- (void)showDatePickerView:(UIColor *)tintColor datePickerModel:(UIDatePickerMode)model minimumDate:(NSDate *)minimumDate maximumDate:(NSDate *)maximumDate defaultDate:(NSString *)dateString commitBlock:(void(^)(NSString *date))commitBlock cancelBlock:(void(^)())cancelBlock;
@end
//
// YXDatePickerView.m
// demo
//
// Created by 曹云霄 on 2017/7/17.
// Copyright © 2017年 曹云霄. All rights reserved.
//
#import "YXDatePickerView.h"
@interface YXDatePickerView()
@property (nonatomic, strong) UIView *bgView;
@property (nonatomic, strong) UIView *containerView;
@end
@implementation YXDatePickerView
- (instancetype)initWithFrame:(CGRect)frame
{
[self initToolBar];
[self initContainerView];
CGRect initialFrame;
if (CGRectIsEmpty(frame)) {
initialFrame = CGRectMake(0, self.toolbar.frame.size.height, WIDTH, 216);
} else {
initialFrame = frame;
}
self = [super initWithFrame:initialFrame];
if (self) {
self.backgroundColor = [UIColor whiteColor];
self.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[self initBgView];
}
return self;
}
- (void)initBgView
{
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, HEIGHT - self.frame.size.height - 44, WIDTH, self.frame.size.height + self.toolbar.frame.size.height)];
}
- (void)initToolBar
{
self.toolbar = [[YXToolbar alloc] initWithFrame:CGRectMake(0, 0, WIDTH, 44)];
self.toolbar.translucent = NO;
}
- (void)initContainerView
{
self.containerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)];
self.containerView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.4];
self.containerView.userInteractionEnabled = YES;
[self.containerView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hiddenWithAnimation)]];
}
- (void)showWithAnimation {
[self addViews];
self.containerView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.0];
CGFloat height = self.bgView.frame.size.height;
self.bgView.center = CGPointMake(WIDTH / 2, HEIGHT + height / 2);
[UIView animateWithDuration:0.25 animations:^{
self.bgView.center = CGPointMake(WIDTH / 2, HEIGHT - height / 2);
self.containerView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.4];
}];
}
- (void)hiddenWithAnimation {
CGFloat height = self.bgView.frame.size.height;
[UIView animateWithDuration:0.25 animations:^{
self.bgView.center = CGPointMake(WIDTH / 2, HEIGHT + height / 2);
self.containerView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.0];
} completion:^(BOOL finished) {
[self hiddenViews];
}];
}
- (void)addViews {
UIWindow *window = [UIApplication sharedApplication].keyWindow;
[window addSubview:self.containerView];
[window addSubview:self.bgView];
[self.bgView addSubview:self.toolbar];
[self.bgView addSubview:self];
}
- (void)hiddenViews {
[self removeFromSuperview];
[self.toolbar removeFromSuperview];
[self.bgView removeFromSuperview];
[self.containerView removeFromSuperview];
}
- (void)showDatePickerView:(UIColor *)tintColor datePickerModel:(UIDatePickerMode)model minimumDate:(NSDate *)minimumDate maximumDate:(NSDate *)maximumDate defaultDate:(NSString *)dateString commitBlock:(void (^)(NSString *))commitBlock cancelBlock:(void (^)())cancelBlock
{
if (dateString) {
self.date = [self returnDate:dateString];
}else {
self.date = [NSDate date];
}
self.datePickerMode = model;
self.minimumDate = minimumDate;
self.maximumDate = maximumDate;
self.toolbar.tintColor = tintColor;
[self showWithAnimation];
__weak typeof(self) weakSelf = self;
self.toolbar.cancelBlock = ^ {
if (cancelBlock) {
[weakSelf hiddenWithAnimation];
cancelBlock();
}
};
self.toolbar.commitBlock = ^{
if (commitBlock) {
[weakSelf hiddenWithAnimation];
commitBlock([weakSelf returnDateString:weakSelf.date]);
}
};
}
/**
格式化NSDate
@param date NSDate
@return 时间字符串
*/
- (NSString *)returnDateString:(NSDate *)date
{
NSDateFormatter *format = [[NSDateFormatter alloc] init];
format.dateFormat = @"yyyy-MM-dd HH:mm:ss";
NSString *string = [format stringFromDate:date];
return string;
}
/**
格式化NSString
@param dateString 时间字符串
@return NSDate
*/
- (NSDate *)returnDate:(NSString *)dateString
{
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSDate *date = [dateFormatter dateFromString:dateString];
return date;
}
@end
//
// YXGeneralPickerView.h
// demo
//
// Created by 曹云霄 on 2017/9/22.
// Copyright © 2017年 曹云霄. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "YXToolbar.h"
@interface YXGeneralPickerView : UIPickerView
@property (nonatomic, strong) YXToolbar *toolbar;
/**
显示选择框
@param tintColor 主题颜色
@param defaultString 默认选中
@param commitBlock 确认回调
@param cancelBlock 取消回调
*/
- (void)showGeneralPickerView:(UIColor *)tintColor dataArray:(NSArray<NSString *> *)dataArray defaultString:(NSString *)defaultString commitBlock:(void (^)(NSString *selectedItem,NSInteger index))commitBlock cancelBlock:(void (^)())cancelBlock;
@end
//
// YXGeneralPickerView.m
// demo
//
// Created by 曹云霄 on 2017/9/22.
// Copyright © 2017年 曹云霄. All rights reserved.
//
#import "YXGeneralPickerView.h"
/**
取消回调
*/
typedef void (^CancelBlock)();
@interface YXGeneralPickerView()<UIPickerViewDelegate,UIPickerViewDataSource>
@property (nonatomic, strong) UIView *bgView;
@property (nonatomic, strong) UIView *containerView;
@property (nonatomic, strong) NSArray *datasArray;
/**
选中下标
*/
@property (nonatomic, assign) NSInteger selectedIndex;
@property (nonatomic, copy) CancelBlock block;
@end
@implementation YXGeneralPickerView
- (instancetype)initWithFrame:(CGRect)frame
{
[self initToolBar];
[self initContainerView];
CGRect initialFrame;
if (CGRectIsEmpty(frame)) {
initialFrame = CGRectMake(0, self.toolbar.frame.size.height, WIDTH, 216);
} else {
initialFrame = frame;
}
self = [super initWithFrame:initialFrame];
if (self) {
self.backgroundColor = [UIColor whiteColor];
self.delegate = self;
self.dataSource = self;
self.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[self initBgView];
}
return self;
}
- (void)initBgView
{
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, HEIGHT - self.frame.size.height - 44, WIDTH, self.frame.size.height + self.toolbar.frame.size.height)];
}
- (void)initToolBar
{
self.toolbar = [[YXToolbar alloc] initWithFrame:CGRectMake(0, 0, WIDTH, 44)];
self.toolbar.translucent = NO;
}
- (void)initContainerView
{
self.containerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)];
self.containerView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.4];
self.containerView.userInteractionEnabled = YES;
[self.containerView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hiddenWithAnimation)]];
}
- (void)showWithAnimation {
[self addViews];
self.containerView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.0];
CGFloat height = self.bgView.frame.size.height;
self.bgView.center = CGPointMake(WIDTH / 2, HEIGHT + height / 2);
[UIView animateWithDuration:0.25 animations:^{
self.bgView.center = CGPointMake(WIDTH / 2, HEIGHT - height / 2);
self.containerView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.4];
}];
}
- (void)hiddenWithAnimation {
self.block();
CGFloat height = self.bgView.frame.size.height;
[UIView animateWithDuration:0.25 animations:^{
self.bgView.center = CGPointMake(WIDTH / 2, HEIGHT + height / 2);
self.containerView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.0];
} completion:^(BOOL finished) {
[self hiddenViews];
}];
}
- (void)addViews {
UIWindow *window = [UIApplication sharedApplication].keyWindow;
[window addSubview:self.containerView];
[window addSubview:self.bgView];
[self.bgView addSubview:self.toolbar];
[self.bgView addSubview:self];
}
- (void)hiddenViews {
[self removeFromSuperview];
[self.toolbar removeFromSuperview];
[self.bgView removeFromSuperview];
[self.containerView removeFromSuperview];
}
- (void)showGeneralPickerView:(UIColor *)tintColor dataArray:(NSArray<NSString *> *)dataArray defaultString:(NSString *)defaultString commitBlock:(void (^)(NSString *selectedItem,NSInteger index))commitBlock cancelBlock:(void (^)())cancelBlock
{
self.block = cancelBlock;
self.datasArray = dataArray;
[self showDefaultItem:defaultString];
[self reloadAllComponents];
self.toolbar.tintColor = tintColor;
[self showWithAnimation];
__weak typeof(self) weakSelf = self;
self.toolbar.cancelBlock = ^ {
if (cancelBlock) {
[weakSelf hiddenWithAnimation];
}
};
self.toolbar.commitBlock = ^{
if (commitBlock) {
[weakSelf hiddenWithAnimation];
commitBlock(weakSelf.datasArray[weakSelf.selectedIndex],weakSelf.selectedIndex);
}
};
}
- (void)showDefaultItem:(NSString *)defaultString
{
NSInteger index = [self.datasArray indexOfObject:defaultString];
[self reloadComponent:0];
if (defaultString) {
if (index > self.datasArray.count - 1) {
index = 0;
}
self.selectedIndex = index;
[self selectRow:index inComponent:0 animated:NO];
}else {
self.selectedIndex = 0;
}
}
#pragma mark -<UIPickerViewDelegate,UIPickerViewDataSource>
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
return 1;
}
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
return self.datasArray[row];
}
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component;
{
return self.datasArray.count;
}
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
self.selectedIndex = row;
}
@end
//
// YXPickerManager.h
// YXPickerView
//
// Created by 曹云霄 on 2017/7/14.
// Copyright © 2017年 曹云霄. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "YXAddressPickerView.h"
#import "YXDatePickerView.h"
#import "YXGeneralPickerView.h"
@interface YXPickerManager : NSObject
+ (YXPickerManager *)shareManager;
@property (nonatomic, strong) YXAddressPickerView *addressPickerView;
@property (nonatomic, strong) YXDatePickerView *datePickerView;
@property (nonatomic, strong) YXGeneralPickerView *generalPickerView;
/**
显示省市区选择框
@param tintColor 主题颜色
@param address 默认地址
@param commitBlock 确认回调
@param cancelBlock 取消回调
*/
- (void)showAddressPickerView:(UIColor *)tintColor defaultAddress:(NSString *)address commitBlock:(void(^)(NSString *address,NSString *zipcode))commitBlock cancelBlock:(void(^)())cancelBlock;
/**
显示选择框
@param tintColor 主题颜色
@param dataArray 默认选中
@param defaultString 默认选中
@param commitBlock 确认回调
@param cancelBlock 取消回调
*/
- (void)showGeneralPickerView:(UIColor *)tintColor dataArray:(NSArray<NSString *> *)dataArray defaultString:(NSString *)defaultString commitBlock:(void (^)(NSString *selectedItem,NSInteger index))commitBlock cancelBlock:(void (^)())cancelBlock;
/**
显示时间选择框
@param tintColor 主题颜色
@param model NSDate类型
@param minimumDate 最小时间
@param maximumDate 最大时间
@param dateString 默认时间字符串
@param commitBlock 确认回调
@param cancelBlock 取消回调
*/
- (void)showDatePickerView:(UIColor *)tintColor datePickerModel:(UIDatePickerMode)model minimumDate:(NSDate *)minimumDate maximumDate:(NSDate *)maximumDate defaultDate:(NSString *)dateString commitBlock:(void(^)(NSString *date))commitBlock cancelBlock:(void(^)())cancelBlock;
@end
//
// YXPickerManager.m
// YXPickerView
//
// Created by 曹云霄 on 2017/7/14.
// Copyright © 2017年 曹云霄. All rights reserved.
//
#import "YXPickerManager.h"
@implementation YXPickerManager
+ (YXPickerManager *)shareManager
{
static YXPickerManager *manager = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
manager = [[YXPickerManager alloc] init];
});
return manager;
}
- (YXAddressPickerView *)addressPickerView
{
if (!_addressPickerView) {
_addressPickerView = [[YXAddressPickerView alloc] init];
}
return _addressPickerView;
}
- (YXDatePickerView *)datePickerView
{
if (!_datePickerView) {
_datePickerView = [[YXDatePickerView alloc] init];
}
return _datePickerView;
}
- (YXGeneralPickerView *)generalPickerView
{
if (!_generalPickerView) {
_generalPickerView = [[YXGeneralPickerView alloc] init];
}
return _generalPickerView;
}
- (void)showAddressPickerView:(UIColor *)tintColor defaultAddress:(NSString *)address commitBlock:(void (^)(NSString *, NSString *))commitBlock cancelBlock:(void (^)())cancelBlock
{
[self.addressPickerView showAddressPickerView:tintColor defaultAddress:address commitBlock:^(NSString *address, NSString *zipcode) {
commitBlock(address,zipcode);
} cancelBlock:^{
if (cancelBlock) {
cancelBlock();
}
}];
}
- (void)showGeneralPickerView:(UIColor *)tintColor dataArray:(NSArray<NSString *> *)dataArray defaultString:(NSString *)defaultString commitBlock:(void (^)(NSString *selectedItem,NSInteger index))commitBlock cancelBlock:(void (^)())cancelBlock
{
[self.generalPickerView showGeneralPickerView:tintColor dataArray:dataArray defaultString:defaultString commitBlock:^(NSString *selectedItem,NSInteger index) {
commitBlock(selectedItem,index);
} cancelBlock:^{
if (cancelBlock) {
cancelBlock();
}
}];
}
- (void)showDatePickerView:(UIColor *)tintColor datePickerModel:(UIDatePickerMode)model minimumDate:(NSDate *)minimumDate maximumDate:(NSDate *)maximumDate defaultDate:(NSString *)dateString commitBlock:(void (^)(NSString *))commitBlock cancelBlock:(void (^)())cancelBlock
{
[self.datePickerView showDatePickerView:tintColor datePickerModel:model minimumDate:minimumDate maximumDate:maximumDate defaultDate:dateString commitBlock:^(NSString *date) {
commitBlock(date);
} cancelBlock:^{
if (cancelBlock) {
cancelBlock();
}
}];
}
@end
//
// YXToolbar.h
// YXPickerView
//
// Created by 曹云霄 on 2017/7/14.
// Copyright © 2017年 曹云霄. All rights reserved.
//
#import <UIKit/UIKit.h>
#define WIDTH [[UIScreen mainScreen] bounds].size.width
#define HEIGHT [[UIScreen mainScreen] bounds].size.height
#define COLOR [UIColor colorWithRed:0.804 green:0.804 blue:0.804 alpha:1]
@interface YXToolbar : UIToolbar
@property (nonatomic, strong) UIBarButtonItem *cancelButtonItem;
@property (nonatomic, strong) UIBarButtonItem *commitButtonItem;
@property (nonatomic, strong) UIBarButtonItem *titleButtonItem;
/**
toolBar主题色
*/
@property (nonatomic, strong) UIColor *toolBarTintColor;
/**
标题
*/
@property (nonatomic, copy) NSString *title;
/**
标题字体颜色
*/
@property (nonatomic, strong) UIColor *titleColor;
/**
取消
*/
@property (nonatomic, copy) NSString *cancelTitle;
/**
取消字体颜色
*/
@property (nonatomic, strong) UIColor *cancelTitleColor;
/**
提交
*/
@property (nonatomic, copy) NSString *commitTitle;
/**
提交字体颜色
*/
@property (nonatomic, strong) UIColor *commitTitleColor;
/**
取消回调
*/
@property (nonatomic,copy) void(^cancelBlock)();
/**
提交回调
*/
@property (nonatomic,copy) void(^commitBlock)();
@end
//
// YXToolbar.m
// YXPickerView
//
// Created by 曹云霄 on 2017/7/14.
// Copyright © 2017年 曹云霄. All rights reserved.
//
#import "YXToolbar.h"
@implementation YXToolbar
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
UIBarButtonItem *leftFixBar = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:self action:nil];
leftFixBar.width = 15;
UIBarButtonItem *rightFixBar = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:self action:nil];
rightFixBar.width = 15;
UIBarButtonItem *spaceItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
self.titleButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"请选择" style:UIBarButtonItemStyleDone target:self action:nil];
self.titleButtonItem.enabled = NO;
[self.titleButtonItem setTitleTextAttributes:@{NSFontAttributeName: [UIFont systemFontOfSize:15],
NSForegroundColorAttributeName : [UIColor lightGrayColor]} forState:UIControlStateNormal];
self.cancelButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"取消" style:UIBarButtonItemStyleDone target:self action:@selector(cancelButtonClickAction)];
self.commitButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"确认" style:UIBarButtonItemStyleDone target:self action:@selector(commitButtonClickAction)];
self.items = @[leftFixBar,self.cancelButtonItem,spaceItem,self.titleButtonItem,spaceItem,self.commitButtonItem,rightFixBar];
self.tintColor = [UIColor redColor];
UIView *bottomLineView = [[UIView alloc] initWithFrame:CGRectMake(0, 43.5, WIDTH, 0.5)];
bottomLineView.backgroundColor = COLOR;
[self addSubview:bottomLineView];
[self bringSubviewToFront:bottomLineView];
}
return self;
}
- (void)setTitle:(NSString *)title
{
if (self.titleButtonItem) {
self.titleButtonItem.title = title;
}
}
- (void)setTitleColor:(UIColor *)titleColor
{
if (self.titleButtonItem) {
self.titleButtonItem.tintColor = titleColor;
}
}
- (void)setToolBarTintColor:(UIColor *)toolBarTintColor
{
self.tintColor = toolBarTintColor;
}
- (void)setCancelTitle:(NSString *)cancelTitle
{
if (self.cancelButtonItem) {
self.cancelButtonItem.title = cancelTitle;
}
}
- (void)setCancelTitleColor:(UIColor *)cancelTitleColor
{
if (self.cancelButtonItem) {
self.cancelButtonItem.tintColor = cancelTitleColor;
}
}
- (void)setCommitTitle:(NSString *)commitTitle
{
if (self.commitButtonItem) {
self.commitButtonItem.title = commitTitle;
}
}
- (void)setCommitTitleColor:(UIColor *)commitTitleColor
{
if (self.commitButtonItem) {
self.commitButtonItem.tintColor = commitTitleColor;
}
}
- (void)cancelButtonClickAction
{
if (self.cancelBlock) {
self.cancelBlock();
}
}
- (void)commitButtonClickAction
{
if (self.commitBlock) {
self.commitBlock();
}
}
@end
......@@ -18,7 +18,6 @@ target ‘IFS’ do
pod 'FDFullscreenPopGesture', '~> 1.1'
pod 'ImagePicker'
pod 'SKPhotoBrowser', '~> 5.0.0'
pod 'YXPickerView'
pod 'YXAlertController'
pod 'PPBadgeViewSwift'
pod 'SVProgressHUD', '~> 2.2.2'
......
......@@ -26,7 +26,6 @@ PODS:
- UMengAnalytics (4.2.4)
- YXAlertController (1.0.8)
- YXKit (0.0.8)
- YXPickerView (2.0.0)
DEPENDENCIES:
- DeviceKit
......@@ -49,7 +48,6 @@ DEPENDENCIES:
- UMengAnalytics
- YXAlertController
- YXKit
- YXPickerView
SPEC CHECKSUMS:
Alamofire: f41a599bd63041760b26d393ec1069d9d7b917f4
......@@ -74,8 +72,7 @@ SPEC CHECKSUMS:
UMengAnalytics: ef8d45f94c0e5771dc364cf6a5731d9d3b101da2
YXAlertController: 37a54642cb8e8b43b79004fe9148bb8ff2fab814
YXKit: 73d6ffbcf7530f1159e030460207286e9153b080
YXPickerView: 527ca74d8fbe73b4e9bd0bbff6e143133dced907
PODFILE CHECKSUM: 0eaafb4a7b07d07aea77b58f3cd8a90edc556faf
PODFILE CHECKSUM: dee9f1dd9eac675051bb335b7b1d13637a8eabc1
COCOAPODS: 1.3.1
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