123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618 |
- //
- // MeCenterVC.m
- // LNManager
- //
- // Created by EchoShacolee on 2017/4/6.
- // Copyright © 2017年 lee. All rights reserved.
- //
- #define defGreen [UIColor colorWithRed:35/255.0 green:160/255.0 blue:227/255.0 alpha:1]
- #import "MeCenterVC.h"
- #import "LoginVC.h"
- #import "NSString+ex.h"
- #import "InputView.h"
- #import "AboutVC.h"
- #import "MyMessageVC.h"
- //客服
- #import "QMChatRoomViewController.h"
- #import <QMChatSDK/QMChatSDK.h>
- #import "QMAlert.h"
- #define PersonVCTop_H kStatusHeight+20
- #define PersonVCRate 1.0/(PersonVCTop_H+100-kNavOffSet)//100为头视图上defgreen高度
- @interface MeCenterVC ()<UITableViewDelegate,UITableViewDataSource,UINavigationControllerDelegate, UIImagePickerControllerDelegate,InputViewDelegate,UINavigationControllerDelegate>
- {
- NSArray *_contentArr; //要显示的内容
- NSArray *_imgArray; //菜单图片
- InputView *_inputVi; //照片选择
-
- UIImageView *_headImgV; //头像
- UILabel *nameLabel;
- UILabel *schoolNamelabel;
-
- //客服
- BOOL _isFirstClick; // 判断点击状态
- BOOL _isPushed; // 判断跳转状态
- }
- @property(nonatomic,strong)UIView *topView;
- //客服
- @property (nonatomic, assign) BOOL isPushed; // 控制跳转
- @property (nonatomic, assign) BOOL isConnecting; // 控制多次注册
- @property (nonatomic, copy) NSDictionary * dictionary; //客服一些配置
- @end
- @implementation MeCenterVC
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- self.navigationItem.title = @"个人";
- _contentArr = @[@[@"我的资料",@"绑定手机",@"修改密码"],
- @[@"使用手册",@"联系客服",@"关于我们"],
- @[@"退出登录"]
- ];
- _imgArray = @[@[@"center_img1",@"center_img2",@"center_img3"],
- @[@"center_img4",@"center_img5",@"center_img6"],
- @[@"center_img7"]];
-
- [self myInit];
- }
- - (void)viewWillAppear:(BOOL)animated {
- [super viewWillAppear:animated];
- _isPushed = NO;
- self.navigationController.navigationBar.alpha = 0;
- [self setPersonData];
- }
- - (void)viewWillDisappear:(BOOL)animated {
- [super viewWillDisappear:animated];
- _isPushed = YES;
- self.navigationController.navigationBar.alpha = 1.0;
- }
- -(void)myInit{
-
- CGFloat x,y,w,h;
- x = 0;
- y = 0;
- w = kSize.width;
- h = PersonVCTop_H;
-
- _topView = [[UIView alloc] KSetxywh];
- _topView.backgroundColor = defGreen;
- [self.view addSubview:_topView];
-
- y+=h;
- h=117;
- UIView *headView = [[UIView alloc] KSetxywh];
- headView.backgroundColor = KBackGroundColor;
-
- y -= PersonVCTop_H;
- h = 100;
- UIView *view = [[UIView alloc] KSetxywh];
- view.backgroundColor = defGreen;
- [headView addSubview:view];
-
- x = y = 15;
- w = h = 70;
- UIImageView *imgView = [[UIImageView alloc] KSetxywh];
- [imgView setModeAspectFill];
- imgView.layer.masksToBounds = YES;
- imgView.layer.cornerRadius = h/2.0;
- [view addSubview:imgView];
- _headImgV = imgView;
-
- UIButton *btn = [[UIButton alloc] KSetxywh];
- [btn addTarget:self action:@selector(tapClick) forControlEvents:UIControlEventTouchUpInside];
- [view addSubview:btn];
-
- x += w + 10;
- y -= 5;
- w = kSize.width - x;
- h = 40;
- UILabel *label = [[UILabel alloc] KSetxywh];
- [label setText:@"欢迎您!" Font:FontTitle TextColor:[UIColor blackColor]];
- [view addSubview:label];
- nameLabel = label;
-
- y += h;
- label = [[UILabel alloc] KSetxywh];
- [label setText:@"" Font:Font17 TextColor:[UIColor blackColor]];
- [view addSubview:label];
- schoolNamelabel = label;
-
- [self setPersonData];
-
-
-
- UITableView * tableview = [[UITableView alloc]initWithFrame:CGRectMake(0, PersonVCTop_H, kSize.width, kSize.height-PersonVCTop_H-kTabBarHeight) style:UITableViewStyleGrouped];
-
- [tableview registerClass:[UITableViewCell class] forCellReuseIdentifier:@"me_cellID"];
- tableview.delegate = self;
- tableview.dataSource = self;
- tableview.showsVerticalScrollIndicator = NO;
- tableview.rowHeight = 50;
-
- tableview.tableHeaderView = headView;
-
- view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 60)];
- tableview.tableFooterView = view;
-
- [self.view addSubview:tableview];
-
- [self.view insertSubview:tableview belowSubview:_topView];
-
- //客服
- [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(registerSuccess:) name:CUSTOM_LOGIN_SUCCEED object:nil];
- [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(registerFailure:) name:CUSTOM_LOGIN_ERROR_USER object:nil];
-
- _isConnecting = NO;
- _isPushed = NO;
- }
- - (void)setPersonData
- {
- if ([MYAPPDELEGATE.userDic[@"photo"] length] > 0) {
- [_headImgV sd_setImageWithURL:[NSURL URLWithString:MYAPPDELEGATE.userDic[@"photo"]] placeholderImage:[UIImage imageNamed:@"me_DefaultHead"]];
- }else {
- _headImgV.image = [UIImage imageNamed:@"me_DefaultHead"];
- }
-
- NSString *nameString = @"欢迎您!";
- if ([MYAPPDELEGATE.userDic[@"realName"] length] > 0) {
- nameString = [NSString stringWithFormat:@"%@,欢迎您!",MYAPPDELEGATE.userDic[@"realName"]];
- }
- nameLabel.text = nameString;
- schoolNamelabel.text = [NSString stringWithFormat:@"%@ %@",MYAPPDELEGATE.userDic[@"dqmc"],MYAPPDELEGATE.userDic[@"qxmc"]];
- }
- #pragma mark 照片选择
- -(void)tapClick{
-
- InputView* vi = [[InputView alloc] initWithTitle:@"请选择头像"];
- [vi setDelegate:self];
- [vi show];
- _inputVi = vi;
- }
- -(void)InputView:(InputView *)view didGetImage:(UIImage *)image {
-
- [self upLoadImgWithImage:image];
- }
- -(void)InputViewWillPickImage:(InputView *)view
- {
- UIImagePickerController *pickerImage = [[UIImagePickerController alloc] init];
- if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) {
- pickerImage.sourceType = view.type;
- // pickerImage.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
- pickerImage.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:pickerImage.sourceType];
- }
- pickerImage.delegate = self;
- pickerImage.allowsEditing = NO;
-
- [self presentViewController:pickerImage animated:YES completion:nil];
- }
- - (void) imagePickerController:(UIImagePickerController *)picker
- didFinishPickingMediaWithInfo:(NSDictionary *)info
- {
- [_inputVi cancelAction];
- [picker dismissViewControllerAnimated:YES completion:^{
- UIImage *originalImage = [info objectForKey:UIImagePickerControllerOriginalImage];
- [self upLoadImgWithImage:originalImage];
- }];
- }
- #pragma mark 头像上传
- -(void)upLoadImgWithImage:(UIImage *)image
- {
- if (!image) {
- return;
- }
-
- NSData * data;
- if (UIImageJPEGRepresentation(image, .5))
- {
- //图片质量 压缩成多少
- data = UIImageJPEGRepresentation(image, .5);
- }else{
- data = UIImagePNGRepresentation(image);
- }
-
- NSString *encodedImageStr = [data base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength];
-
- NSMutableDictionary * mDic = [NSMutableDictionary new];
- [mDic setValue:@"1" forKey:@"type"];
- [mDic setValue:MYAPPDELEGATE.userDic[@"id"] forKey:@"keyword"];
- [mDic setValue:encodedImageStr forKey:@"content"];
-
- [self getDataWithDic:mDic method:@"upload-1" block:^(NSDictionary *successDic) {
- [self showMsgByMBWithString:@"修改头像成功"];
- [_headImgV sd_setImageWithURL:[NSURL URLWithString:successDic[@"body"]] placeholderImage:[UIImage imageNamed:@"me_DefaultHead"]];
- [MYAPPDELEGATE.userDic setValue:successDic[@"body"] forKey:@"photo"];
- }];
- }
- #pragma mark tableview代理相关
- -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
-
- return _contentArr.count;
- }
- -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
-
- return [_contentArr[section] count];
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
-
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"me_cellID" forIndexPath:indexPath];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
-
- cell.imageView.image = [UIImage imageNamed:[_imgArray[indexPath.section] objectAtIndex:indexPath.row]];
- cell.textLabel.text = _contentArr[indexPath.section][indexPath.row];
- cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
-
- return cell;
- }
- -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
-
- if (indexPath.section == 0){
-
- if (indexPath.row == 0) {
- //我的资料
- MyMessageVC *vc = [[MyMessageVC alloc]init];
- [self.navigationController pushViewController:vc animated:YES];
- return;
- return;
- }
-
- if (indexPath.row == 1) {
- //绑定手机
- [self showMsgByMBWithString:unOpenMsg];
- return;
- }
-
- if (indexPath.row == 2) {
- //修改密码
- [self fixKey];
- return;
- }
-
- }else if (indexPath.section == 1){
-
- if (indexPath.row == 0) {
- //使用手册
- [self showMsgByMBWithString:unOpenMsg];
- return;
- }
-
- if (indexPath.row == 1) {
- //联系客服
- if (_isConnecting) {
- return;
- }
- _isConnecting = YES;
- [MBProgressHUD showHUDAddedTo:self.view animated:YES];
-
- // userId 只能使用 数字 字母(包括大小写) 下划线
- NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
- NSString *name = [NSString stringWithFormat:@"%@[闽I监管_%@]",MYAPPDELEGATE.userDic[@"realName"],version];
- [QMConnect registerSDKWithAppKey:CUSTOMERSERVICE_APPKEY userName:name userId:[NSString stringWithFormat:@"%@",MYAPPDELEGATE.userDic[@"id"]]];
-
- return;
- }
-
- if (indexPath.row == 2) {
-
- AboutVC *vc = [[AboutVC alloc]init];
- [self.navigationController pushViewController:vc animated:YES];
- return;
- }
-
- }else if (indexPath.section == 2 && indexPath.row == 0){
- //退出登录
- [self loginAciton];
- }
-
- }
- -(void)scrollViewDidScroll:(UIScrollView *)scrollView{
-
- //topview
- CGRect newFrame = self.topView.frame;
- CGFloat settingViewOffsetY = PersonVCTop_H - scrollView.contentOffset.y;
- newFrame.size.height = settingViewOffsetY;
-
- // NSLog(@"%f,%f",scrollView.contentOffset.y,newFrame.size.height);
-
- if (settingViewOffsetY < PersonVCTop_H) {
- newFrame.size.height = PersonVCTop_H;
- }
- self.topView.frame = newFrame;
- //navBar
- self.navigationController.navigationBar.alpha = PersonVCRate*scrollView.contentOffset.y;
-
- // NSLog(@"-->> %f", self.navigationController.navigationBar.alpha);
- }
- #pragma mark 修改密码
- -(void)fixKey
- {
- UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"验证原密码" message:nil preferredStyle:UIAlertControllerStyleAlert];
- [alert addTextFieldWithConfigurationHandler:^(UITextField * textField) {
- textField.placeholder = @"请输入原密码";
- }];
-
- [alert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil]];
- [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
-
- NSString *text = [[alert.textFields firstObject] text];
- NSString *key = MYAPPDELEGATE.userDic[@"password"];
-
- if (![[text md5Encrypt] isEqualToString:key]) {
- [self showMsgByMBWithString:@"原密码错误!"];
- return;
- }
-
- [self willModifyPwd];
-
- }]];
- dispatch_async(dispatch_get_main_queue(), ^{
- [self.tabBarController presentViewController:alert animated:true completion:nil];
- });
- }
- -(void)willModifyPwd{
-
- UIAlertController *alertFind = [UIAlertController alertControllerWithTitle:@"修改密码" message:nil preferredStyle:UIAlertControllerStyleAlert];
-
- [alertFind addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
- textField.placeholder = @"请输入新密码";
- textField.secureTextEntry = YES;
- }];
-
- [alertFind addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
- textField.placeholder = @"请确认密码";
- textField.secureTextEntry = YES;
- }];
- [alertFind addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil]];
- [alertFind addAction:[UIAlertAction actionWithTitle:@"确定修改" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
- // 读取文本框的值显示出来
- UITextField *newtf1 = alertFind.textFields[0];
- UITextField *newtf = alertFind.textFields[1];
- if (newtf1.text.length < 6 || newtf.text.length < 6) {
- [self showMsgByMBWithString:@"密码长度不能少于6个字符"];
- return;
- }
-
- if (![newtf1.text isEqualToString:newtf.text])
- {
- UIAlertController *noname = [UIAlertController alertControllerWithTitle:@"提示" message:@"密码不一致,请您核查" preferredStyle:UIAlertControllerStyleAlert];
- [noname addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleCancel handler:nil]];
- dispatch_async(dispatch_get_main_queue(), ^{
- [self.tabBarController presentViewController:noname animated:true completion:nil];
- });
- return;
-
- }
-
-
- [self chanagePasswordWithOldStr:MYAPPDELEGATE.userDic[@"password"] newStr:[newtf.text md5Encrypt]];
- }]];
- dispatch_async(dispatch_get_main_queue(), ^{
- [self.tabBarController presentViewController:alertFind animated:true completion:nil];
- });
-
- }
- -(void)chanagePasswordWithOldStr:(NSString *)oldpwd newStr:(NSString *)newpwd{
-
- NSMutableDictionary * mdic = [NSMutableDictionary new];
- [mdic setValue:MYAPPDELEGATE.userDic[@"id"] forKey:@"id"];
- [mdic setValue:oldpwd forKey:@"oldPwd"];
- [mdic setValue:newpwd forKey:@"newPwd"];
-
- [self getDataWithDic:mdic method:@"modifyPwd" block:^(NSDictionary *successDic) {
-
- //修改成功,返回登录界面,重新登录
- UIAlertController * alert = [UIAlertController alertControllerWithTitle:nil message:@"修改成功,请重新登录" preferredStyle:UIAlertControllerStyleAlert];
- [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
- [ud setObject:@"" forKey:@"userPassWord"];
- [ud synchronize];//先这样吧。如果非要清除显示占用的密码再做处理
- [self.tabBarController dismissViewControllerAnimated:YES completion:nil];
- }]];
- [self.tabBarController presentViewController:alert animated:YES completion:nil];
- }];
-
- }
- -(void)loginAciton{
-
- MYAPPDELEGATE.userDic = nil;
- [LoginVC saveAppIosImei];
-
- NSUserDefaults *defatluts = [NSUserDefaults standardUserDefaults];
- [defatluts removeObjectForKey:@"userPassWord"];
- [defatluts synchronize];
-
- [self setPersonData];
-
- LoginVC * loginvc = [[LoginVC alloc]init];
- MYAPPDELEGATE.window.rootViewController = loginvc;
- }
- #pragma mark 客服
- - (void)registerSuccess:(NSNotification *)sender {
- NSLog(@"注册成功");
- if (_isPushed) {
- [MBProgressHUD hideHUDForView:self.view animated:NO];
- _isConnecting = NO;
- return;
- }
- // [QMConnect sdkGetWebchatScheduleConfig:^(NSDictionary * _Nonnull scheduleDic) {
- // dispatch_async(dispatch_get_main_queue(), ^{
- // self.dictionary = scheduleDic;
- // if ([self.dictionary[@"scheduleEnable"] intValue] == 1) {
- // NSLog(@"日程管理");
- // [self starSchedule];
- // }else{
- // NSLog(@"技能组");
- // [self getPeers];
- // }
- // });
- // } failBlock:^{
- //
- // }];
-
- [self getPeers];
- }
- - (void)registerFailure:(NSNotification *)sender {
- NSLog(@"注册失败::%@", sender.object);
- self.isConnecting = NO;
- [MBProgressHUD hideHUDForView:self.view animated:NO];
- }
- #pragma mark - 技能组选择
- - (void)getPeers {
- [QMConnect sdkGetPeers:^(NSArray * _Nonnull peerArray) {
- dispatch_async(dispatch_get_main_queue(), ^{
- NSLog(@"%@", peerArray);
- NSArray *peers = peerArray;
- self.isConnecting = NO;
- [MBProgressHUD hideHUDForView:self.view animated:NO];
- if (peers.count == 1 && peers.count != 0) {
- [self showChatRoomViewController:[peers.firstObject objectForKey:@"id"] processType:@""];
- }else {
- [self showPeersWithAlert:peers messageStr:@"选择您咨询的类型或业务部门(对应技能组)"];
- }
- });
- } failureBlock:^{
- dispatch_async(dispatch_get_main_queue(), ^{
- [MBProgressHUD hideHUDForView:self.view animated:NO];
- self.isConnecting = NO;
- });
- }];
- }
- #pragma mark - 日程管理
- - (void)starSchedule {
- self.isConnecting = NO;
- [MBProgressHUD hideHUDForView:self.view animated:NO];
- if ([self.dictionary[@"scheduleId"] isEqual: @""] || [self.dictionary[@"processId"] isEqual: @""] || [self.dictionary objectForKey:@"entranceNode"] == nil || [self.dictionary objectForKey:@"leavemsgNodes"] == nil) {
- [QMAlert showMessage:@"对不起,由于在线咨询配置错误,暂时无法进行咨询"];
- }else{
-
- NSDictionary *entranceNode = self.dictionary[@"entranceNode"];
- NSArray *entrances = entranceNode[@"entrances"];
- NSLog(@" 获取到日程节点数组 ===== %@", entrances);
- // [self showPeersWithAlert: sdkEntrances];
- if (entrances.count == 1 && entrances.count != 0) {
- [self showChatRoomViewController:[entrances.firstObject objectForKey:@"processTo"] processType:[entrances.firstObject objectForKey:@"processType"]];
- }else{
- [self showPeersWithAlert:entrances messageStr:@"选择您咨询的日程管理类型"];
- }
- }
- }
- - (void)showPeersWithAlert: (NSArray *)peers messageStr: (NSString *)message {
- UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:@"选择您咨询的类型或业务部门(对应技能组)" preferredStyle:UIAlertControllerStyleAlert];
- UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
- self.isConnecting = NO;
- }];
- [alertController addAction:cancelAction];
- for (NSDictionary *index in peers) {
- UIAlertAction *surelAction = [UIAlertAction actionWithTitle:[index objectForKey:@"name"] style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- if ([self.dictionary[@"scheduleEnable"] integerValue] == 1) {
- [self showChatRoomViewController:[index objectForKey:@"processTo"] processType:[index objectForKey:@"processType"]];
- }else{
- [self showChatRoomViewController:[index objectForKey:@"id"] processType:@""];
- }
- }];
- [alertController addAction:surelAction];
- }
- [self presentViewController:alertController animated:YES completion:nil];
- }
- #pragma mark - 跳转聊天界面
- - (void)showChatRoomViewController:(NSString *)peerId processType:(NSString *)processType {
- QMChatRoomViewController *chatRoomViewController = [[QMChatRoomViewController alloc] init];
- chatRoomViewController.peerId = peerId;
- chatRoomViewController.isPush = NO;
- NSString *path = MYAPPDELEGATE.userDic[@"photo"];
- if (!path) {
- path = @"";
- }
- chatRoomViewController.avaterStr = path;
- if ([self.dictionary[@"scheduleEnable"] intValue] == 1) {
- chatRoomViewController.isOpenSchedule = true;
- chatRoomViewController.scheduleId = self.dictionary[@"scheduleId"];
- chatRoomViewController.processId = self.dictionary[@"processId"];
- chatRoomViewController.currentNodeId = peerId;
- chatRoomViewController.processType = processType;
- }else{
- chatRoomViewController.isOpenSchedule = false;
- }
- [self.navigationController pushViewController:chatRoomViewController animated:YES];
- }
- - (NSMutableAttributedString *)setSpace:(CGFloat)line kern:(NSNumber *)kern font:(UIFont *)font text:(NSString *)text {
- NSMutableParagraphStyle * paraStyle = [NSMutableParagraphStyle new];
- paraStyle.lineBreakMode = NSLineBreakByCharWrapping;
- paraStyle.alignment = NSTextAlignmentCenter;
- paraStyle.lineSpacing = line;
- paraStyle.hyphenationFactor = 1.0;
- paraStyle.firstLineHeadIndent = 0.0;
- paraStyle.paragraphSpacingBefore = 0.0;
- paraStyle.headIndent = 0;
- paraStyle.tailIndent = 0;
- NSDictionary *attributes = @{
- NSFontAttributeName: font,
- NSParagraphStyleAttributeName: paraStyle,
- NSKernAttributeName: kern
- };
- NSMutableAttributedString *attributeStr = [[NSMutableAttributedString alloc] initWithString:text attributes:attributes];
- return attributeStr;
- }
- - (void)dealloc {
- [[NSNotificationCenter defaultCenter] removeObserver:self name:CUSTOM_LOGIN_SUCCEED object:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:CUSTOM_LOGIN_ERROR_USER object:nil];
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- @end
|