123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- //
- // SendNotifyVC.m
- // LNManager
- //
- // Created by EchoShacolee on 2017/6/21.
- // Copyright © 2017年 lee. All rights reserved.
- //
- #import "SendNotifyVC.h"
- @interface SendNotifyVC ()<UIScrollViewDelegate>
- {
- UITextField * _tf;
- UITextView * _tx;
- }
- @end
- @implementation SendNotifyVC
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- self.navigationItem.title = @"编辑通知";
-
- //
- UIScrollView * scrV = [[UIScrollView alloc]initWithFrame:kFrame];
- scrV.contentSize = CGSizeMake(0, kSize.height);
- scrV.showsVerticalScrollIndicator = NO;
- scrV.delegate = self;
- [self.view addSubview:scrV];
-
- UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapHandle)];
- [scrV addGestureRecognizer:tap];
-
- UILabel *lab1 = [[UILabel alloc]initWithFrame:CGRectMake(20, 20, kSize.width-40, 40)];
- lab1.text = @"请输入通知标题:";
- lab1.font = [UIFont systemFontOfSize:17];
- [scrV addSubview:lab1];
-
- _tf = [[UITextField alloc]initWithFrame:CGRectMake(20, 60, kSize.width-40, 35)];
- _tf.backgroundColor = [UIColor whiteColor];
- _tf.font = [UIFont systemFontOfSize:15];
- _tf.clipsToBounds = YES;
- _tf.layer.cornerRadius = 5;
- _tf.layer.borderWidth = .2;
- [scrV addSubview:_tf];
-
- UILabel *lab = [[UILabel alloc]initWithFrame:CGRectMake(20, 115, kSize.width-40, 30)];
- lab.text = @"请输入通知内容:";
- lab.font = [UIFont systemFontOfSize:17];
- [scrV addSubview:lab];
-
- _tx = [[UITextView alloc]initWithFrame:CGRectMake(20, 145, kSize.width-40, 180)];
- _tx.backgroundColor = [UIColor whiteColor];
- _tx.font = [UIFont systemFontOfSize:14];
- _tx.textColor = [UIColor darkGrayColor];
- _tx.clipsToBounds = YES;
- _tx.layer.cornerRadius = 5;
- _tx.layer.borderWidth = .2;
- [scrV addSubview:_tx];
-
- UIButton * btn = [[UIButton alloc]initWithFrame:CGRectMake(20, 350, kSize.width-40, 50)];
- btn.backgroundColor = COLOR_THEME;
- btn.clipsToBounds = YES;
- btn.layer.cornerRadius = 5;
- [btn setTitle:@"发送" textColor:[UIColor whiteColor] font:15 fotState:0];
- [btn addTarget:self action:@selector(btnClick) forControlEvents:UIControlEventTouchUpInside];
- [scrV addSubview:btn];
- }
- -(void)btnClick{
-
- if (_tf.text.length == 0 || _tx.text.length == 0) {
- [self showMsgByAlertVCWithString:@"通知内容或标题不能为空"];
- return;
- }
-
- NSMutableString *str = [NSMutableString new];
- for (NSString *obj in self.ids) {
- [str appendFormat:@",%@",obj];
- }
- NSString * idsStr = [str substringFromIndex:1];
- NSMutableDictionary *mdic = [NSMutableDictionary new];
- [mdic setValue:idsStr forKey:@"ids"];
- [mdic setValue:_tf.text forKey:@"title"];
- [mdic setValue:_tx.text forKey:@"content"];
- [mdic setValue:_type forKey:@"type"];
- [mdic setValue:MYAPPDELEGATE.userDic[@"crUserName"] forKey:@"sendUserName"];
- __weak typeof(self) weakSelf = self;
- [self getDataWithDic:mdic method:@"addNotice" block:^(NSDictionary *successdic) {
- UIAlertController *alertFind = [UIAlertController alertControllerWithTitle:nil message:successdic[@"msg"] preferredStyle:UIAlertControllerStyleAlert];
- [alertFind addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- [weakSelf.navigationController popToRootViewControllerAnimated:YES];
- }]];
-
- [weakSelf presentViewController:alertFind animated:true completion:nil];
-
- }];
-
- }
- -(void)tapHandle{
-
- [self.view endEditing:YES];
- }
- -(void)scrollViewDidScroll:(UIScrollView *)scrollView{
-
- [self.view endEditing:YES];
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- /*
- #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
|