123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- //
- // CYEditTitleViewController.m
- // shiku_im
- //
- // Created by Ron on 2019/11/16.
- // Copyright © 2019 Reese. All rights reserved.
- //
- #import "CYEditTitleViewController.h"
- #import "CYActiveTitleViewController.h"
- @interface CYEditTitleViewController ()
- @property (nonatomic,strong) UIImageView * memberView;
- @property (nonatomic,strong) UITextField *memberAccountText;
- @property (nonatomic,strong) NSMutableArray *array;
- @end
- @implementation CYEditTitleViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
- self.isGotoBack = YES;
- self.title = @"编辑头衔";
- self.heightFooter = 0;
- self.heightHeader = JX_SCREEN_TOP;
- [self createHeadAndFoot];
-
- self.tableBody.scrollEnabled = YES;
- self.tableBody.contentSize = CGSizeMake(self_width, JX_SCREEN_HEIGHT - JX_SCREEN_TOP);
- self.tableBody.showsVerticalScrollIndicator = YES;
- int h = 0;
-
- [_memberView removeFromSuperview];
- _memberView = [[UIImageView alloc] initWithFrame:CGRectMake(0, h, JX_SCREEN_WIDTH, self.tableBody.frame.size.height)];
- _memberView.userInteractionEnabled = YES;
- _memberView.backgroundColor = HEXCOLOR(0xf0eff4);;
- [self.tableBody addSubview:_memberView];
-
- self.memberAccountText = [[UITextField alloc] initWithFrame:CGRectMake(0,1, JX_SCREEN_WIDTH, 40)];
- self.memberAccountText.borderStyle = UITextBorderStyleNone;
- self.memberAccountText.backgroundColor = [UIColor whiteColor];
- self.memberAccountText.placeholder = [NSString stringWithFormat:@" %@",self.rankTitle];
- self.memberAccountText.font = [UIFont systemFontOfSize:15];
- [self.memberAccountText addTarget:self action:@selector(memberAcountTextFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
- [_memberView addSubview:self.memberAccountText];
- h+=_memberAccountText.frame.size.height;
-
- UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(20, h, JX_SCREEN_WIDTH -40, 30)];
- label.backgroundColor = [UIColor clearColor];
- label.numberOfLines = 0;
- label.textColor = UIColor.blackColor;
- label.textAlignment = NSTextAlignmentLeft;
- label.text = [NSString stringWithFormat:@"请编辑%ld级成员头衔",_num];
- [_memberView addSubview:label];
-
- // button.customView.frame = CGRectMake(self_width-50, JX_SCREEN_TOP - 38, 65, 30);
- // UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(JX_SCREEN_WIDTH - JX_SCREEN_TOP - 38, 30, 40, 20)];
- // [button setTitle:@"确定" forState:UIControlStateNormal];
- // [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
- // [button addTarget:self action:@selector(okClick) forControlEvents:UIControlEventTouchUpInside];
- // [self.tableHeader addSubview:button];
-
- UILabel *sureLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
- sureLabel.text = @"确定";
- UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithCustomView:sureLabel];
- [sureLabel addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(okClick)]];
- sureLabel.userInteractionEnabled = YES;
- [self setRightBarButtonItem:item];
-
-
- }
- -(void)memberAcountTextFieldDidChange:(UITextField *)send{
- // self.memberAccountStr = send.text;
- NSLog(@"title:%@",send.text);
- }
- - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
-
- [self.view endEditing:YES];
- }
- -(void)okClick{
-
- NSString *groupLevelName = self.memberAccountText.text;
- NSMutableArray *array = [NSMutableArray arrayWithArray:self.nameArr];
- [array replaceObjectAtIndex:_nameArr.count - self.num withObject:groupLevelName];
- NSArray *newArray = [[array reverseObjectEnumerator] allObjects];
- groupLevelName = [newArray componentsJoinedByString:@","];
- _array = newArray.copy;
- // 数组翻转
-
- // 发请求改头衔
-
- [g_server updateRoom:self.room key:@"groupLevelName" value:groupLevelName toView:self];
-
-
- }
- - (void)didServerResultSucces:(JXConnection*)aDownload dict:(NSDictionary*)dict array:(NSArray*)array1{
- if([aDownload.action isEqualToString:act_roomSet]){
-
-
-
- [g_notify postNotificationName:kgroupLevelNameRefresh object:_array];
- [g_navigation popToViewController:[CYActiveTitleViewController class] animated:YES];
- }
-
- }
- /*
- #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
|