123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258 |
- //
- // CYGroupNameRankViewController.m
- // shiku_im
- //
- // Created by Ron on 2019/11/14.
- // Copyright © 2019 Reese. All rights reserved.
- //
- #import "CYGroupNameRankViewController.h"
- #import "CYActiveTitleViewController.h"
- #import "JXRoomRemind.h"
- #define HEIGHT 50
- //#define IMGSIZE 150
- #define TopHeight 7
- #define CellHeight 45
- @interface CYGroupNameRankViewController ()
- @property (nonatomic,strong) UIImageView * memberView;
- @property (nonatomic,strong) UILabel * musicTypeLabel;
- @end
- @implementation CYGroupNameRankViewController{
- UISwitch *_topSwitch;
- UISwitch *_tipSwitch;
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.self.isGotoBack = YES;
- 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];
-
- UIImageView *iv =[[UIImageView alloc] init];
- iv.backgroundColor = HEXCOLOR(0xf0eff4);
- iv = [self createButton:@"聊天窗口显示成员头衔" drawTop:YES drawBottom:YES must:NO click:nil superView:_memberView];
- iv.frame = CGRectMake(0, h, JX_SCREEN_WIDTH, HEIGHT);
- _topSwitch = [[UISwitch alloc] init];
- _topSwitch.onTintColor = THEMECOLOR;
- _topSwitch.frame = CGRectMake(JX_SCREEN_WIDTH-INSETS-51, 6, 0, 0);
- _topSwitch.on = _isOpenIntegral;
- _topSwitch.center = CGPointMake(_topSwitch.center.x, iv.frame.size.height/2);
- [_topSwitch addTarget:self action:@selector(topSwitchAction:) forControlEvents:UIControlEventTouchUpInside];
- // [_topSwitch setOn:self.user.topTime];
- [iv addSubview:_topSwitch];
- h+=iv.frame.size.height;
-
- // UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(20, h, JX_SCREEN_WIDTH -40, 100)];
- // label.backgroundColor = [UIColor clearColor];
- // label.numberOfLines = 0;
- // label.textColor = UIColor.blackColor;
- // label.textAlignment = NSTextAlignmentLeft;
- // label.text = @"开启后,好友将收藏至【特别关心】列表中,好友消息/生活圈将有声音提醒和特别提醒。特别关心的好友消息置顶";
- // [_memberView addSubview:label];
- //
- // h+=label.frame.size.height;
-
- // iv = [self createButton:@"好友消息特别提醒" drawTop:YES drawBottom:YES must:NO click:nil superView:_memberView];
- // iv.frame = CGRectMake(0, h, JX_SCREEN_WIDTH, HEIGHT);
- // _tipSwitch = [[UISwitch alloc] init];
- // _tipSwitch.onTintColor = THEMECOLOR;
- // _tipSwitch.frame = CGRectMake(JX_SCREEN_WIDTH-INSETS-51, 6, 0, 0);
- // _tipSwitch.center = CGPointMake(_tipSwitch.center.x, iv.frame.size.height/2);
- // [_tipSwitch addTarget:self action:@selector(tipSwitchAction:) forControlEvents:UIControlEventTouchUpInside];
- // // [_topSwitch setOn:self.user.topTime];
- // [iv addSubview:_tipSwitch];
- // h+=iv.frame.size.height;
-
- iv = [self createButton:@"活跃头衔" drawTop:YES drawBottom:YES must:NO click:@selector(activeRankClick) superView:_memberView];
- iv.frame = CGRectMake(0, h, JX_SCREEN_WIDTH, HEIGHT);
- // _musicTypeLabel = [self createLabel:iv default:@"叮咚"];
- // [iv addSubview:_musicTypeLabel];
- h+=iv.frame.size.height;
-
- // CGRect memFrame = _memberView.frame;
- // memFrame.size.height = h;
- // _memberView.frame = memFrame;
- [_memberView addSubview:iv];
- // return membHeight;
-
-
-
-
- }
- -(void)topSwitchAction:(UISwitch *)send{
-
- // printf();
- // NSLog(@"%lu",(unsigned long)_topSwitch.state);
- self.room.isOpenIntegral = send.on;
- [g_server updateRoomShowRead:self.room key:@"isOpenIntegral" value:self.room.isOpenIntegral toView:self]
- ;
- }
- //-(void)tipSwitchAction:(UISwitch *)send{
- //
- // // printf();
- // NSLog(@"%lu",(unsigned long)_tipSwitch.state);
- //}
- -(void)activeRankClick{
- CYActiveTitleViewController *VC =[[CYActiveTitleViewController alloc] init];
- VC.room = self.room;
- [g_navigation pushViewController:VC animated:true];
- }
- -(JXImageView*)createButton:(NSString*)title drawTop:(BOOL)drawTop drawBottom:(BOOL)drawBottom must:(BOOL)must click:(SEL)click superView:(UIView *)superView{
- JXImageView* btn = [[JXImageView alloc] init];
- btn.backgroundColor = [UIColor whiteColor];
- btn.userInteractionEnabled = YES;
- btn.didTouch = click;
- btn.delegate = self;
- [superView addSubview:btn];
- // [btn release];
-
- if(must){
- UILabel* p = [[UILabel alloc] initWithFrame:CGRectMake(INSETS, 5, 20, HEIGHT-5)];
- p.text = @"*";
- p.font = g_factory.font18;
- p.backgroundColor = [UIColor clearColor];
- p.textColor = [UIColor redColor];
- p.textAlignment = NSTextAlignmentCenter;
- [btn addSubview:p];
- // [p release];
- }
-
- JXLabel* p = [[JXLabel alloc] initWithFrame:CGRectMake(20, 0, 200, HEIGHT)];
- p.text = title;
- p.font = g_factory.font15;
- p.backgroundColor = [UIColor clearColor];
- p.textColor = [UIColor blackColor];
- [btn addSubview:p];
- // if (@selector(onRemark) == click) {
- // _labelLab = p;
- // }
- if(drawTop){
- UIView* line = [[UIView alloc] initWithFrame:CGRectMake(0,0,JX_SCREEN_WIDTH,0.3)];
- line.backgroundColor = [UIColor colorWithRed:0.8 green:0.8 blue:0.8 alpha:1];
- [btn addSubview:line];
- }
-
- if(drawBottom){
- UIView* line = [[UIView alloc]initWithFrame:CGRectMake(0,HEIGHT-0.5,JX_SCREEN_WIDTH,0.3)];
- line.backgroundColor = [UIColor colorWithRed:0.8 green:0.8 blue:0.8 alpha:1];
- [btn addSubview:line];
- }
-
- //这个选择器仅用于判断,之后会修改为不可点击
- SEL check = @selector(switchAction:);
- //创建switch
- if(click == check){
- UISwitch * switchView = [[UISwitch alloc]initWithFrame:CGRectMake(JX_SCREEN_WIDTH-INSETS-51, 6, 20, 20)];
- if ([title isEqualToString:Localized(@"JX_MessageFree")]) {
- // _messageFreeSwitch = switchView;
- // if ([user.offlineNoPushMsg intValue] == 1) {
- // [_messageFreeSwitch setOn:YES];
- // }else {
- // [_messageFreeSwitch setOn:NO];
- // }
- }
-
- switchView.onTintColor = THEMECOLOR;
-
- [switchView addTarget:self action:@selector(switchAction:) forControlEvents:UIControlEventTouchUpInside];
-
- [btn addSubview:switchView];
- //取消调用switchAction
- btn.didTouch = @selector(hideKeyboard);
-
- }else if(click){
- btn.frame = CGRectMake(btn.frame.origin.x -20, btn.frame.origin.y, btn.frame.size.width, btn.frame.size.height);
-
- UIImageView* iv;
- iv = [[UIImageView alloc] initWithFrame:CGRectMake(JX_SCREEN_WIDTH-INSETS-20-3, 15, 20, 20)];
- iv.image = [UIImage imageNamed:@"set_list_next"];
- [btn addSubview:iv];
- // [iv release];
- }
- return btn;
- }
- -(UILabel*)createLabel:(UIView*)parent default:(NSString*)s{
- UILabel* p = [[UILabel alloc] initWithFrame:CGRectMake(JX_SCREEN_WIDTH/2,INSETS,JX_SCREEN_WIDTH/2 - INSETS - 20 - 5,HEIGHT-INSETS*2)];
- p.userInteractionEnabled = NO;
- p.text = s;
- p.font = g_factory.font15;
- p.textAlignment = NSTextAlignmentRight;
- [parent addSubview:p];
- // [p release];
- return p;
- }
- -(void) didServerResultSucces:(JXConnection*)aDownload dict:(NSDictionary*)dict array:(NSArray*)array1{
- [_wait stop];
-
- if( [aDownload.action isEqualToString:act_roomSet] ){
-
- JXUserObject * user = [[JXUserObject alloc]init];
- user = [user getUserById:self.room.roomJid];
- user.showRead = [NSNumber numberWithBool:self.room.showRead];
- user.showMember = [NSNumber numberWithBool:self.room.showMember];
- user.allowSendCard = [NSNumber numberWithBool:self.room.allowSendCard];
- user.chatRecordTimeOut = self.room.chatRecordTimeOut;
- user.talkTime = [NSNumber numberWithLong:self.room.talkTime];
- user.allowInviteFriend = [NSNumber numberWithBool:self.room.allowInviteFriend];
- user.allowUploadFile = [NSNumber numberWithBool:self.room.allowUploadFile];
- user.allowConference = [NSNumber numberWithBool:self.room.allowConference];
- user.allowSpeakCourse = [NSNumber numberWithBool:self.room.allowSpeakCourse];
- user.isNeedVerify = [NSNumber numberWithBool:self.room.isNeedVerify];
- [user update];
-
- JXRoomRemind* p = [[JXRoomRemind alloc] init];
- p.objectId = self.room.roomJid;
-
-
- p.type = [NSNumber numberWithInt:kRoomRemind_RoomIsOpenIntegral];
- p.content = [NSString stringWithFormat:@"%d",self.room.isOpenIntegral];
-
- [p notify];
-
-
-
- [g_App showAlert:Localized(@"JXAlert_UpdateOK")];
- }
- }
- /*
- #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
|