This commit is contained in:
lianxiang 2018-09-17 22:58:04 +08:00
parent 718900a428
commit 1a4b9db16f
22 changed files with 17646 additions and 32 deletions

View File

@ -8,6 +8,8 @@
/* Begin PBXBuildFile section */
6B67B068A469498C38CEF799 /* Pods_GIGA.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B14B65914FBF61910191D7A8 /* Pods_GIGA.framework */; };
83048481214F489000603CE7 /* GiGaUserJobViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 83048480214F488F00603CE7 /* GiGaUserJobViewCell.m */; };
83048486214FACE700603CE7 /* JobMaskButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 83048485214FACE700603CE7 /* JobMaskButton.m */; };
8314D2112133ABE500B458BF /* WeiIXinApiManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 8314D2102133ABE500B458BF /* WeiIXinApiManager.m */; };
83346AC0212BB50A0054D597 /* PassWordResetVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 83346ABE212BB50A0054D597 /* PassWordResetVC.m */; };
83346AC1212BB50A0054D597 /* PassWordResetVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 83346ABF212BB50A0054D597 /* PassWordResetVC.xib */; };
@ -21,6 +23,7 @@
8338F6B12142182200B4780B /* MaskTime.png in Resources */ = {isa = PBXBuildFile; fileRef = 8338F6B02142182100B4780B /* MaskTime.png */; };
8338F6B92142504E00B4780B /* LXCustomSwith.m in Sources */ = {isa = PBXBuildFile; fileRef = 8338F6B82142504E00B4780B /* LXCustomSwith.m */; };
833DA7762122A62000A5C614 /* GiGaMaskTaskViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 833DA7752122A62000A5C614 /* GiGaMaskTaskViewController.m */; };
833DE8D7214FF7F8009D4329 /* city1.js in Resources */ = {isa = PBXBuildFile; fileRef = 833DE8D6214FF7F8009D4329 /* city1.js */; };
8340BF9E213E3846008F22E4 /* SHineLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 8340BF9D213E3846008F22E4 /* SHineLabel.m */; };
8340BFA2213E60DD008F22E4 /* GIGAMBHUDHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 8340BFA1213E60DD008F22E4 /* GIGAMBHUDHelper.m */; };
8340BFA6213E6514008F22E4 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8340BFA5213E6514008F22E4 /* Localizable.strings */; };
@ -174,6 +177,10 @@
/* Begin PBXFileReference section */
055947143A68ADCC68C3F3E1 /* Pods-GIGA.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GIGA.debug.xcconfig"; path = "Pods/Target Support Files/Pods-GIGA/Pods-GIGA.debug.xcconfig"; sourceTree = "<group>"; };
8304847F214F488F00603CE7 /* GiGaUserJobViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiGaUserJobViewCell.h; sourceTree = "<group>"; };
83048480214F488F00603CE7 /* GiGaUserJobViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiGaUserJobViewCell.m; sourceTree = "<group>"; };
83048484214FACE700603CE7 /* JobMaskButton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JobMaskButton.h; sourceTree = "<group>"; };
83048485214FACE700603CE7 /* JobMaskButton.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JobMaskButton.m; sourceTree = "<group>"; };
8314D20F2133ABE500B458BF /* WeiIXinApiManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WeiIXinApiManager.h; sourceTree = "<group>"; };
8314D2102133ABE500B458BF /* WeiIXinApiManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = WeiIXinApiManager.m; sourceTree = "<group>"; };
8314D2122133F44600B458BF /* MobClickList.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MobClickList.h; sourceTree = "<group>"; };
@ -196,6 +203,7 @@
8338F6B82142504E00B4780B /* LXCustomSwith.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LXCustomSwith.m; sourceTree = "<group>"; };
833DA7742122A62000A5C614 /* GiGaMaskTaskViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiGaMaskTaskViewController.h; sourceTree = "<group>"; };
833DA7752122A62000A5C614 /* GiGaMaskTaskViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiGaMaskTaskViewController.m; sourceTree = "<group>"; };
833DE8D6214FF7F8009D4329 /* city1.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = city1.js; sourceTree = "<group>"; };
8340BF9C213E3846008F22E4 /* SHineLabel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SHineLabel.h; sourceTree = "<group>"; };
8340BF9D213E3846008F22E4 /* SHineLabel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SHineLabel.m; sourceTree = "<group>"; };
8340BFA0213E60DD008F22E4 /* GIGAMBHUDHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GIGAMBHUDHelper.h; sourceTree = "<group>"; };
@ -855,6 +863,8 @@
83BFAE74213CDE91004EF801 /* GiGaSettingsViewCell.h */,
83BFAE75213CDE91004EF801 /* GiGaSettingsViewCell.m */,
83BFAE76213CDE91004EF801 /* GiGaSettingsViewCell.xib */,
83048484214FACE700603CE7 /* JobMaskButton.h */,
83048485214FACE700603CE7 /* JobMaskButton.m */,
);
path = View;
sourceTree = "<group>";
@ -1043,9 +1053,9 @@
838762CF214B9CAA0039D241 /* userInfoView */ = {
isa = PBXGroup;
children = (
838762D2214B9D120039D241 /* GIGaUserInfoAvatorCell.xib */,
838762D0214B9D120039D241 /* GIGaUserInfoAvatorCell.h */,
838762D1214B9D120039D241 /* GIGaUserInfoAvatorCell.m */,
838762D2214B9D120039D241 /* GIGaUserInfoAvatorCell.xib */,
838762D5214B9EF80039D241 /* GIGaUserIDViewCell.h */,
838762D6214B9EF80039D241 /* GIGaUserIDViewCell.m */,
838762D7214B9EF80039D241 /* GIGaUserIDViewCell.xib */,
@ -1058,6 +1068,8 @@
838762E4214B9FA60039D241 /* GIGaUserCityViewCell.h */,
838762E5214B9FA60039D241 /* GIGaUserCityViewCell.m */,
838762E6214B9FA60039D241 /* GIGaUserCityViewCell.xib */,
8304847F214F488F00603CE7 /* GiGaUserJobViewCell.h */,
83048480214F488F00603CE7 /* GiGaUserJobViewCell.m */,
);
path = userInfoView;
sourceTree = "<group>";
@ -1107,6 +1119,7 @@
83901167214E20B2004CA790 /* JYAddressPicker */ = {
isa = PBXGroup;
children = (
833DE8D6214FF7F8009D4329 /* city1.js */,
83901168214E20B2004CA790 /* JYAddressPicker.h */,
83901169214E20B2004CA790 /* citys.json */,
8390116A214E20B2004CA790 /* JYAddressPicker.m */,
@ -1349,6 +1362,7 @@
838762D9214B9EF80039D241 /* GIGaUserIDViewCell.xib in Resources */,
838762E8214B9FA60039D241 /* GIGaUserCityViewCell.xib in Resources */,
83BFAE68213CCF10004EF801 /* GiGaMineUserViewCell.xib in Resources */,
833DE8D7214FF7F8009D4329 /* city1.js in Resources */,
8340BFA9213E65CA008F22E4 /* GIGACommonLocalizabe.strings in Resources */,
83835BA8212E4748001480F2 /* MAssaageCenterCell.xib in Resources */,
8361B3D3212155C300238FEB /* Assets.xcassets in Resources */,
@ -1459,6 +1473,7 @@
83346AC5212BBC8C0054D597 /* GiGaRegistViewController.m in Sources */,
83346AD7212C18F50054D597 /* GiGaAppGaurdVC.m in Sources */,
8349585C212511040064DB6C /* AppDelegate+ThirdParty.m in Sources */,
83048481214F489000603CE7 /* GiGaUserJobViewCell.m in Sources */,
83BFAE73213CDB58004EF801 /* GiSysSettingsVC.m in Sources */,
838762D8214B9EF80039D241 /* GIGaUserIDViewCell.m in Sources */,
838500DC2137F3F7003514A3 /* GiGaAttributedLabel.m in Sources */,
@ -1473,6 +1488,7 @@
83BFAE6C213CD0E3004EF801 /* GiGaMineInfoViewCell.m in Sources */,
8390116B214E20B2004CA790 /* LYSDateContentView.m in Sources */,
83BC8A872148BE8A00820437 /* NYPopover.m in Sources */,
83048486214FACE700603CE7 /* JobMaskButton.m in Sources */,
83901176214E20B2004CA790 /* LYSDatePickerTypeDayDelegate.m in Sources */,
8384643E214A484400F12B33 /* MaskTestResult.m in Sources */,
83346AD4212BFF6E0054D597 /* UserGuardViewController.m in Sources */,

View File

@ -0,0 +1,13 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "btn_job@2x.png",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -1,9 +1,17 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "sex_disselect@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {

View File

@ -1,9 +1,17 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "sex_selected@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {

View File

@ -0,0 +1,13 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "userjob_down@2x.png",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -0,0 +1,13 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "userjob_up@2x.png",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -130,7 +130,6 @@
}
- (void)checkNetwork{
AFNetworkReachabilityManager *manager = [AFNetworkReachabilityManager sharedManager];
[manager startMonitoring];

View File

@ -111,7 +111,9 @@
if ([selectedItem[@"childrens"] count] == 0) {
//
[self.showIndexs replaceObjectAtIndex:component withObject:@(row)];
}else{
NSUInteger replaceIdx = component;
@ -122,10 +124,12 @@
}else{
if (replaceIdx < [self.showIndexs count]) {
NSArray *childrens = selectedItem[@"childrens"];
[self.showAddressArr replaceObjectAtIndex:replaceIdx withObject:selectedItem[@"childrens"]];
[self.showAddressArr replaceObjectAtIndex:replaceIdx withObject:childrens];
[self.showIndexs replaceObjectAtIndex:replaceIdx withObject:@(0)];
selectedItem = [selectedItem[@"childrens"] firstObject];
selectedItem = [childrens firstObject];
}else{
next = false;
}
@ -133,8 +137,8 @@
replaceIdx ++;
}
}
[pickerView reloadAllComponents];
//
for (NSInteger index = 0; index < [self.showIndexs count]; index ++) {
@ -155,7 +159,7 @@
NSString *jsonPath = [[NSBundle mainBundle] pathForResource:@"citys" ofType:@"json"];
NSData *data = [[NSData alloc] initWithContentsOfFile:jsonPath];
NSError *error = nil;
NSArray *citysArr = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];
NSArray *citysArr = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&error];
//
[self defaultShowValue:[NSMutableArray arrayWithArray:defaultValues] items:citysArr];
@ -184,6 +188,7 @@
-(void)defaultShowValue:(NSMutableArray *)values items:(NSArray *)items
{
[items enumerateObjectsUsingBlock:^(NSDictionary *obj, NSUInteger idx, BOOL * _Nonnull stop) {
if ([@"" isEqualToString:[values firstObject]])
{
@ -191,15 +196,20 @@
[self.showIndexs addObject:@(0)];
[values removeObjectAtIndex:0];
[self.showAddressArr addObject:items];
[self defaultShowValue:values items:obj[@"childrens"]];
NSArray *childs = obj[@"childrens"];
if (!childs) {
childs = @[];
}
[self defaultShowValue:values items:childs];
}
else if ([obj[@"text"] isEqualToString:[values firstObject]])
{
[self.showIndexs addObject:@(idx)];
[values removeObjectAtIndex:0];
[self.showAddressArr addObject:items];
[self defaultShowValue:values items:obj[@"childrens"]];
NSArray *childs = obj[@"childrens"];
[self defaultShowValue:values items:childs];
}
}];
}

File diff suppressed because it is too large Load Diff

View File

@ -13985,7 +13985,8 @@
"value": "2929",
"text": "崇明县",
"childrens": []
},
},
{
"value": "290001",
"text": "黄浦区",
@ -14060,7 +14061,8 @@
"value": "290015",
"text": "青浦区",
"childrens": []
},
},
{
"value": "290016",
"text": "南汇区",

View File

@ -8,9 +8,17 @@
#ifndef ApiRequestConfig_h
#define ApiRequestConfig_h
//登录
#define kApiUserLogin @"sys/v1/login"
//获取用户信息
#define kApiUserInfo @"user/v1/info"
//职业数据
#define kApiOccuption @"sys/sysdict/v1/maskoccupation"
//修改用户信息
#define kFixUserInfo @"user/v1/editinfo"
//头像上传
#define kUploadAvator @"sys/oss/v1/upload"
#endif /* ApiRequestConfig_h */

View File

@ -37,10 +37,11 @@
self.tableView.estimatedSectionFooterHeight= 0;
self.tableView.estimatedSectionHeaderHeight = 0;
self.tableView.bounces = NO;
self.tableView.frame = CGRectMake(0,PhoneX_TopMargin + 1, KMainW,KMainH - PhoneX_BottomMargin);
self.tableView.frame = CGRectMake(0, 1, KMainW, self.view.bounds.size.height - SAFE_NAV_HEIGHT);
[self loadUserInfo];
}
-(void)loadUserInfo{
GiGaUser *currentuser = [[GiGaUserManager shareUser] getCurrentUser];

View File

@ -16,18 +16,31 @@
#import "GiGaUserManager.h"
#import "LYSDatePickerController.h"
#import "JYAddressPicker.h"
#import "GiGaBaseAPiRequest.h"
#import "GiGaUserJobViewCell.h"
@interface GiGaUserViewController ()<LYSDatePickerSelectDelegate>
@property (nonatomic,strong) GiGaUser *user;
@property (nonatomic,strong) NSMutableArray *jobArr;
@property (nonatomic) BOOL jobSpread;
@end
@implementation GiGaUserViewController
- (NSArray *)jobArr{
if (!_jobArr) {
_jobArr = [NSMutableArray new];
}
return _jobArr;
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
//self.title = @"个人中心";
_jobSpread = NO;
[self getJobInfos];
self.user = [[GiGaUserManager shareUser] getCurrentUser];
[self addNavTitile:@"个人信息"];
@ -50,15 +63,18 @@
self.tableView.backgroundColor = [UIColor whiteColor];
self.tableView.separatorStyle = UITableViewCellSelectionStyleNone;
self.tableView.sectionFooterHeight = 0;
self.tableView.estimatedSectionFooterHeight= 0;
self.tableView.estimatedSectionFooterHeight= 10;
self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 10)];
self.tableView.estimatedSectionHeaderHeight = 0;
self.tableView.bounces = NO;
self.tableView.frame = CGRectMake(0,PhoneX_TopMargin + 1, KMainW,KMainH - PhoneX_BottomMargin);
self.tableView.bounces = YES;
self.tableView.frame = CGRectMake(0, 1, KMainW,self.view.bounds.size.height - SAFE_NAV_HEIGHT);
[self.tableView registerClass: [GiGaUserJobViewCell class] forCellReuseIdentifier:@"GiGaUserJobViewCell"];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 3;
return 4;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
@ -67,8 +83,11 @@
return 1;
}else if (section == 1){
return 3;
}else if (section == 3){
return 1;
}
return 4;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
@ -86,7 +105,6 @@
cell = [[[NSBundle mainBundle] loadNibNamed:@"GIGaUserIDViewCell" owner:self options:nil] lastObject];
}
[cell loadCellData:indexPath user: self.user];
return cell;
@ -121,8 +139,30 @@
cell = [[[NSBundle mainBundle] loadNibNamed:@"GIGaUserCityViewCell" owner:self options:nil] lastObject];
}
[cell loadCellData:indexPath user:self.user];
return cell;
}else if (indexPath.section == 3){
static NSString *cellID = @"GiGaUserJobViewCell";
GiGaUserJobViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID forIndexPath:indexPath];
if (!cell) {
cell = [[GiGaUserJobViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellID];
}
[cell userSelectjobAction:^() {
self.jobSpread = !self.jobSpread;
[tableView reloadSections:[NSIndexSet indexSetWithIndex:3] withRowAnimation:UITableViewRowAnimationNone];
}];
[cell setButtnImage:self.jobSpread with:self.jobArr];
[cell userSelectjob:^(NSString *title) {
self.user.occupationCode = title;
[tableView reloadRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:3 inSection:2]] withRowAnimation:UITableViewRowAnimationNone];
}];
return cell;
}
return nil;
}
@ -131,33 +171,47 @@
if (indexPath.section == 2 && indexPath.row == 1) {
[LYSDatePickerController alertDatePickerWithController:self type:(LYSDatePickerTypeDay)];
[LYSDatePickerController customPickerDelegate:self];
weakify(self);
[LYSDatePickerController customdidSelectDatePicker:^(NSDate *date) {
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"yyyy/MM/dd"];
NSString *currentDate = [dateFormat stringFromDate:date];
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
cell.detailTextLabel.text = currentDate;
GIGaUserCityViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
weakSelf.user.birthday = currentDate;
[cell loadCellData:indexPath user:weakSelf.user];
}];
}else if (indexPath.section == 2 && indexPath.row == 2){
JYAddressPicker *addressPicker = [JYAddressPicker jy_showAt:self];
weakify(self);
addressPicker.selectedItemBlock = ^(NSArray *addressArr) {
NSString *province = [addressArr objectAtIndex:0][@"text"];
NSString *city = [addressArr objectAtIndex:1][@"text"];
NSString *county = [addressArr objectAtIndex:2][@"text"];
NSString *addres = [NSString stringWithFormat:@"%@%@%@",province,city,county];
GILog(@"%@",addres);
GIGaUserCityViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
weakSelf.user.provinceName = province;
weakSelf.user.cityName = city;
weakSelf.user.areaName = county;
[cell loadCellData:indexPath user:self.user];
};
}
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
if(indexPath.section==0){
return 133;
}else if (indexPath.section==3){
if (self.jobArr.count <= 0) {
return 0;
}else{
return self.jobSpread == YES ? 246 : 85;
}
}else {
return 44;
}
@ -168,6 +222,7 @@
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
if (section == 1){
return 10;
}else if (section == 2){
@ -192,10 +247,67 @@
}
#pragma mark -
-(void)saveUserInfo{
if (!self.user.nickName || [self.user.nickName isKindOfClass:[NSNull class]]) {
self.user.nickName = @"";
}
if (!self.user.weixin || [self.user.weixin isKindOfClass:[NSNull class]]) {
self.user.weixin = @"";
}
if (!self.user.birthday || [self.user.birthday isKindOfClass:[NSNull class]]) {
self.user.birthday = @"";
}
if (!self.user.occupationCode|| [self.user.occupationCode isKindOfClass:[NSNull class]]) {
self.user.occupationCode = @"";
}
NSDictionary *param = @{
@"provinceId":@"1_11",
@"cityId":@"1_11",
@"areaId":@"1_11_8",
@"nickName":self.user.nickName,
@"weixin":self.user.weixin,
@"sexCode":[NSString stringWithFormat:@"%d",self.user.sexCode],
@"birthday":self.user.birthday,
@"occupationCode":self.user.occupationCode
};
GiGaBaseAPiRequest *api =[GiGaBaseAPiRequest initWithRequestPath:kFixUserInfo method:RequestPostMethod parms:param];
[api requstDataWithResult:^(GiGaAPIResult *result) {
if (result.success) {
GIGA_ShowToast(@"修改成功");
}else{
GIGA_ShowToast(result.dic[@"msg"]);
}
}];
}
#pragma mark -
-(void)getJobInfos{
NSDictionary *param = @{};
GiGaBaseAPiRequest *api =[GiGaBaseAPiRequest initWithRequestPath:kApiOccuption method:RequestPostMethod parms:param];
[api requstDataWithResult:^(GiGaAPIResult *result) {
if (result.success) {
GILog(@"%@",result.dic);
NSDictionary *dic = result.dic;
NSArray *josA = dic[@"list"];
for (NSDictionary *jobDic in josA ) {
[self.jobArr addObject:jobDic[@"dictLabel"]];
}
[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:3] withRowAnimation:UITableViewRowAnimationNone];
}else{
NSString *msg = result.dic[@"msg"];
GIGA_ShowToast(msg);
}
}];
}
@end

View File

@ -25,7 +25,7 @@
[self.view addSubview:self.tableView];
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.backgroundColor = [UIColor lightGrayColor];
self.tableView.backgroundColor = [UIColor whiteColor];
self.tableView.separatorStyle = UITableViewCellSelectionStyleNone;
self.tableView.sectionFooterHeight = 0;
self.tableView.estimatedSectionFooterHeight= 0;
@ -49,7 +49,6 @@
if(!cell){
cell = [[[NSBundle mainBundle] loadNibNamed:@"GiGaSettingsViewCell" owner:self options:nil] lastObject];
}
[cell loadCellDataAt:indexPath];
return cell;
@ -59,7 +58,6 @@
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
@ -84,11 +82,13 @@
[btn setTitle:@"退出登录" forState:UIControlStateNormal];
btn.layer.masksToBounds = YES;
btn.layer.cornerRadius = btn.frame.size.height / 2;
btn.backgroundColor = [UIColor greenColor];
btn.backgroundColor = GIGA_MAIN_BGCOLOR;
[btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[btn addTarget:self action:@selector(userLogOutAction) forControlEvents:UIControlEventTouchUpInside];
[view addSubview:btn];
return view;
}
- (void)didReceiveMemoryWarning {

View File

@ -0,0 +1,13 @@
//
// JobMaskButton.h
// GIGA
//
// Created by lianxiang on 2018/9/17.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface JobMaskButton : UIButton
@property (nonatomic,copy) NSString *jobStr;
@end

View File

@ -0,0 +1,21 @@
//
// JobMaskButton.m
// GIGA
//
// Created by lianxiang on 2018/9/17.
// Copyright © 2018 com.giga.ios. All rights reserved.
//
#import "JobMaskButton.h"
@implementation JobMaskButton
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end

View File

@ -18,7 +18,7 @@
-(void)loadCellData:(NSIndexPath*)indexPath user:(GiGaUser*)user{
if (indexPath.section == 2 && indexPath.row == 1) {
self.cityLabel.text = @"生日";
if (user.birthday && ![user.birthday isKindOfClass:[NSNull class]]) {
if (user.birthday && ![user.birthday isKindOfClass:[NSNull class]] && ![user.birthday isEqualToString:@""]) {
self.detalTitle.text = user.birthday;
}else{
self.detalTitle.text = @"选择生日";
@ -26,17 +26,28 @@
}else if (indexPath.section == 2 && indexPath.row == 2){
self.cityLabel.text = @"城市";
if (user.cityName && ![user.cityName isKindOfClass:[NSNull class]]) {
self.detalTitle.text = user.cityName;
}else{
if (!user.provinceName || [user.provinceName isKindOfClass:[NSNull class]]) {
user.provinceName = @"";
}
if (!user.cityName || [user.cityName isKindOfClass:[NSNull class]]) {
user.cityName = @"";
}
if (!user.areaName || [user.areaName isKindOfClass:[NSNull class]]) {
user.areaName = @"";
}
if ([user.provinceName isEqualToString:@""] && [user.provinceName isEqualToString:@""] && [user.provinceName isEqualToString:@""] ) {
self.detalTitle.text = @"选择城市";
}else{
self.detalTitle.text = [NSString stringWithFormat:@"%@%@%@",user.provinceName,user.cityName,user.areaName];
}
}else if (indexPath.section == 2 && indexPath.row == 3){
self.cityLabel.text = @"职业";
if (user.occupationCode && ![user.occupationCode isKindOfClass:[NSNull class]]) {
if (user.occupationCode && ![user.occupationCode isKindOfClass:[NSNull class]] && ![user.occupationCode isEqualToString:@""]) {
self.detalTitle.text = user.occupationCode;
}else{
self.detalTitle.text = @"选择职业";
self.detalTitle.text = @"请从下方标签中选择一项";
}
}

View File

@ -0,0 +1,27 @@
//
// GiGaUserJobViewCell.h
// GIGA
//
// Created by lianxiang on 2018/9/17.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <UIKit/UIKit.h>
//展开关闭按钮
typedef void (^jobBtnAction)(void);
//选中
typedef void (^jobSelectAction)(NSString *title);
@interface GiGaUserJobViewCell : UITableViewCell
@property (nonatomic,strong) UIButton *upDownBtn;
@property (nonatomic,strong) NSArray *jobs;
-(void)userSelectjobAction:(jobBtnAction)block;
@property (nonatomic,copy) jobBtnAction actionblock;
-(void)userSelectjob:(jobSelectAction)block;
@property (nonatomic,copy) jobSelectAction jobblock;
-(void)setButtnImage:(BOOL)isUp with:(NSArray *)titles;
@end

View File

@ -0,0 +1,237 @@
//
// GiGaUserJobViewCell.m
// GIGA
//
// Created by lianxiang on 2018/9/17.
// Copyright © 2018 com.giga.ios. All rights reserved.
//
#import "GiGaUserJobViewCell.h"
#import "JobMaskButton.h"
#define SPACE_X 8.f //
#define SPACE_Y 8.f //
#define MAR_GAINX 22.f //
#define MARK_H 31.f //
@interface GiGaUserJobViewCell()
@property (nonatomic,assign) int countY;
@property (nonatomic,assign) int countX;
@property (nonatomic,strong) NSArray *titles;
@property (nonatomic,copy) NSString *selectjob;
@end
@implementation GiGaUserJobViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.selectionStyle = UITableViewCellSelectionStyleNone;
_countY = 0;
_countX = 0;
[self creatUI];
self.titles = [NSArray new];
//self.backgroundColor = [UIColor blueColor];
}
return self;
}
-(void)creatUI{
[self addSubview:self.upDownBtn];
}
-(void)updateActionBtnFrame{
_upDownBtn.frame = CGRectMake(KMainW - 22 - 55,self.frame.size.height - 31, 55, 31);
}
- (UIButton *)upDownBtn{
if (!_upDownBtn) {
_upDownBtn = [UIButton buttonWithType:UIButtonTypeCustom];
_upDownBtn.frame = CGRectMake(KMainW - 22 - 55, 10, 55, 31);
[_upDownBtn addTarget:self action:@selector(upDownBtnAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _upDownBtn;
}
-(void)upDownBtnAction:(UIButton *)btn{
if (btn.selected) {
NSLog(@"up");
}else{
NSLog(@"down");
}
//btn.selected = btn.selected;
self.actionblock();
}
-(void)setButtnImage:(BOOL)isUp with:(NSArray *)titles{
self.titles = titles;
self.selectjob = @"";
if (isUp) {
[self setUpUPSubViewstitles:titles isUp:isUp];
}else{
[self setUpDownSubviewstitles:titles isUp:isUp];
}
}
-(void)setUpUPSubViewstitles:(NSArray *)titles isUp:(BOOL)isUp{
//
[_upDownBtn setBackgroundImage:[UIImage imageNamed:@"userjob_up"] forState:UIControlStateNormal];
if (titles.count > 0) {
for (JobMaskButton *btn in self.subviews) {
if ([btn isKindOfClass:[JobMaskButton class]]) {
[btn removeFromSuperview];
}
}
_countX =0;
_countY = 0;
CGFloat X = MAR_GAINX;
for (int i=0; i<titles.count; i ++) {
CGFloat width = 0;
NSString *title = titles[i];
if (title.length == 2) {
width = 55;
}else if (title.length == 3){
width = 68;
}else if (title.length == 4){
width = 88;
}else{
//[self makeToast:@"最小两个字"];
width = 55;
}
[self creatjob:titles[i] index:i isUp:isUp orinX:X width:width];
if (_countX == 0) {
X = MAR_GAINX;
}else{
X = X + width + SPACE_X;
}
}
}
}
-(void)setUpDownSubviewstitles:(NSArray *)titles isUp:(BOOL)isUp{
//
[_upDownBtn setBackgroundImage:[UIImage imageNamed:@"userjob_down"] forState:UIControlStateNormal];
if (titles.count > 0) {
// [titles enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
// NSString *title = obj;
// [self creatjob:title index:idx];
// }];
for (JobMaskButton *btn in self.subviews) {
if ([btn isKindOfClass:[JobMaskButton class]]) {
[btn removeFromSuperview];
}
}
_countX =0;
_countY = 0;
CGFloat X = MAR_GAINX;
for (int i=0; i<titles.count; i ++) {
CGFloat width = 0;
NSString *title = titles[i];
if (title.length == 2) {
width = 55;
}else if (title.length == 3){
width = 68;
}else if (title.length == 4){
width = 88;
}else{
//[self makeToast:@"最小两个字"];
width = 55;
}
[self creatjob:titles[i] index:i isUp:isUp orinX:X width:width];
if (_countX == 0) {
X = MAR_GAINX;
}else{
X = X + width + SPACE_X;
}
}
}
}
-(void)creatjob:(NSString *)title index:(int)idx isUp:(BOOL)isUp orinX:(CGFloat)X width:(CGFloat)width{
CGFloat Y = 10 + (MARK_H + SPACE_Y)*_countY;
_countX ++;
if (!isUp) {
//
if ((X + width + SPACE_X) > (KMainW - 55 - 22)){
return;
}
}else{
if (_countY == 0) {
if ((X + width + SPACE_X) > (KMainW - 55 - 22)){
_countY ++;
_countX = 0;
}
}else{
if ((X + width + SPACE_X) > (KMainW - 22 - width)){
_countY ++;
_countX = 0;
}
if (idx == self.titles.count - 1) {
[self updateActionBtnFrame];
}
}
}
JobMaskButton *jobBtn = [JobMaskButton buttonWithType:UIButtonTypeCustom];
[jobBtn setBackgroundImage:[UIImage imageNamed:@"btn_job"] forState:UIControlStateNormal];
jobBtn.jobStr = title;
NSAttributedString *attri = [GiGaHelper stringWithText:title textColor:GIGARGB(151, 151, 151, 1) textFont:GIGA_TEXTFONTMEDIUM(13) leterSpace:0];
[jobBtn setAttributedTitle:attri forState:UIControlStateNormal];
jobBtn.frame = CGRectMake(X,Y, width, MARK_H);
[jobBtn addTarget:self action:@selector(jobClick:) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:jobBtn];
}
-(void)userSelectjobAction:(jobBtnAction)block{
self.actionblock = block;
}
-(void)userSelectjob:(jobSelectAction)block{
self.jobblock = block;
}
-(void)jobClick:(JobMaskButton *)btn{
self.jobblock(btn.jobStr);
}
- (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