当前位置: 首页 > news >正文

做货运代理网站wordpress建设论坛

做货运代理网站,wordpress建设论坛,wordpress 虎嗅网,网址提交入口大全一、实现功能说明 #xff08;1#xff09;点击注销按钮#xff0c;弹出一个对话框#xff0c;点击确定后移除当前栈顶的控制器#xff0c;返回开始界面#xff0c;点击取消#xff0c;不做任何操作。 注意#xff1a;注销按钮的单击事件已经进行了连线。实现-(void)ac…一、实现功能说明 1点击注销按钮弹出一个对话框点击确定后移除当前栈顶的控制器返回开始界面点击取消不做任何操作。 注意注销按钮的单击事件已经进行了连线。实现-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex需要遵守UIActionSheetDelegate协议。 1 //注销按钮2 - (IBAction)logoutBtn:(id)sender {3 4 UIActionSheet *sheet [[UIActionSheet alloc]initWithTitle:确定要注销? delegate:self cancelButtonTitle:取消 destructiveButtonTitle:确定 otherButtonTitles: nil];5 6 [sheet showInView:self.view];7 }8 9 #pragma mark-代理方法 10 -(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex 11 { 12 if (buttonIndex!0)return; 13 //移除栈顶的控制器 14 [self.navigationController popViewControllerAnimated:YES]; 15 } 2当两个文本框的状态发生改变时通知添加按钮变为可用状态。 知识点通知注册监听 1 - (void)viewDidLoad2 {3 [super viewDidLoad];4 5 //1.获得通知中心6 NSNotificationCenter *center[NSNotificationCenter defaultCenter];7 //2.注册监听8 [center addObserver:self selector:selector(textChange) name:UITextFieldTextDidChangeNotification object:self.nameFeild];9 [center addObserver:self selector:selector(textChange) name:UITextFieldTextDidChangeNotification object:self.phoneFeild]; 10 } 11 12 13 14 //当文本框内容改变的时候通知self调用该方法 15 -(void)textChange 16 { 17 //判断如果两个文本框的内容都改变有值的时候添加按钮变成可交互的 18 self.addBtn.enabled(self.nameFeild.text.length0self.phoneFeild.text.length0); 19 NSLog(通知调用的事件); 20 } 21 22 //临终遗言 23 -(void)dealloc 24 { 25 [[NSNotificationCenter defaultCenter] removeObserver:self]; 26 } 3数据的逆传使用代理 YYContatcsViewController.m文件 1 //2 // YYContatcsViewController.m3 // 01-私人通讯录登录页面搭建4 //5 // Created by apple on 14-6-8.6 // Copyright (c) 2014年 itcase. All rights reserved.7 //8 9 #import YYContatcsViewController.h10 #import YYAddViewController.h11 #import YYInfoModel.h12 13 //遵守协议14 interface YYContatcsViewController ()UIActionSheetDelegate,YYAddViewControllerDelegate15 property (strong, nonatomic) IBOutlet UITableView *tableview;16 17 //数组用来保存用户添加的数据18 property(nonatomic,strong)NSMutableArray *array;19 20 - (IBAction)logoutBtn:(id)sender;21 22 end23 24 implementation YYContatcsViewController25 26 27 - (void)viewDidLoad28 {29 [super viewDidLoad];30 }31 32 //注销按钮33 - (IBAction)logoutBtn:(id)sender {34 35 UIActionSheet *sheet [[UIActionSheet alloc]initWithTitle:确定要注销? delegate:self cancelButtonTitle:取消 destructiveButtonTitle:确定 otherButtonTitles: nil];36 37 [sheet showInView:self.view];38 }39 40 #pragma mark-代理方法41 -(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex42 {43 if (buttonIndex!0)return;44 //移除栈顶的控制器45 [self.navigationController popViewControllerAnimated:YES];46 }47 48 49 -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender50 {51 UIViewController *csegue.destinationViewController;52 YYAddViewController *addc(YYAddViewController *)c;53 addc.delegateself;54 55 }56 57 #pragma mark-YYAddViewControllerDelegate58 -(void)addViewControllerDidAddBtn:(YYAddViewController *)addViewController contatc:(YYInfoModel *)contatc59 {60 //1.把数组保存到数组中61 // [self.Info addObject:contatc];62 // //2.刷新表格63 // NSLog(%,contatc);64 // NSLog(%,self.Info);65 // [self.tableview reloadData];66 NSLog(%,%,contatc.name,contatc.phone);67 [self.array addObject:contatc];68 [self.tableview reloadData];69 70 }71 72 -(NSMutableArray *)array73 {74 if (_arrayNil) {75 _array[NSMutableArray array];76 }77 return _array;78 }79 #pragma mark-tableview的数据源80 //一共有多少行81 -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section82 {83 // return self.Info.count;84 return self.array.count;85 }86 //每组每行的cell87 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath88 {89 static NSString *identifierinfo;90 //先去缓存中取。如果缓存中没有那么就到storyboard中去查找91 UITableViewCell *cell[tableView dequeueReusableCellWithIdentifier:identifier];92 //在storyboard中设置cell的标识符为info93 94 //设置cell的数据95 // 96 // UITableViewCell *cell[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:Nil];97 98 YYInfoModel *infoself.array[indexPath.row];99 cell.textLabel.textinfo.name; 100 cell.detailTextLabel.textinfo.phone; 101 102 103 //返回cell 104 return cell; 105 } 106 end YYAddViewController.h文件 1 //2 // YYAddViewController.h3 // 01-私人通讯录登录页面搭建4 //5 // Created by 孔医己 on 14-6-8.6 // Copyright (c) 2014年 itcase. All rights reserved.7 //8 9 #import UIKit/UIKit.h 10 class YYAddViewController, YYInfoModel; 11 //自定义一个协议让上一个控制器YYContatcsViewController成为当前控制器的代理 12 13 //protocol YYAddViewControllerDelegate NSObject 14 // 15 ////协议方法 16 //-(void)addViewControllerDidAddBtn:(YYAddViewController *)addViewController contatc:(YYInfoModel *)contatc; 17 18 protocol YYAddViewControllerDelegate NSObject 19 20 //- (void)editViewControllerDidAddBtn:(NJEditViewController *)editViewController name:(NSString *)name number:(NSString *)phoneNumber; 21 22 - (void)addViewControllerDidAddBtn:(YYAddViewController *)editViewController contatc:(YYInfoModel *)contatc; 23 24 end 25 26 interface YYAddViewController : UIViewController 27 28 //新增一个代理属性 29 property(nonatomic,strong)idYYAddViewControllerDelegate delegate; 30 31 end YYAddViewController.m文件 1 //2 // YYAddViewController.m3 // 01-私人通讯录登录页面搭建4 //5 // Created by 孔医己 on 14-6-8.6 // Copyright (c) 2014年 itcase. All rights reserved.7 //8 9 #import YYAddViewController.h 10 #import YYInfoModel.h 11 12 interface YYAddViewController () 13 //姓名输入框 14 property (weak, nonatomic) IBOutlet UITextField *nameFeild; 15 //电话号码输入框 16 property (weak, nonatomic) IBOutlet UITextField *phoneFeild; 17 //添加按钮 18 property (weak, nonatomic) IBOutlet UIButton *addBtn; 19 20 //添加按钮的点击事件 21 - (IBAction)addBtnOnclick:(id)sender; 22 23 end 24 25 implementation YYAddViewController 26 27 28 #pragma mark- 监听是否添加 29 - (void)viewDidLoad 30 { 31 [super viewDidLoad]; 32 33 //1.获得通知中心 34 NSNotificationCenter *center[NSNotificationCenter defaultCenter]; 35 //2.注册监听 36 [center addObserver:self selector:selector(textChange) name:UITextFieldTextDidChangeNotification object:self.nameFeild]; 37 [center addObserver:self selector:selector(textChange) name:UITextFieldTextDidChangeNotification object:self.phoneFeild]; 38 } 39 40 41 42 //当文本框内容改变的时候通知self调用该方法 43 -(void)textChange 44 { 45 //判断如果两个文本框的内容都改变有值的时候添加按钮变成可交互的 46 self.addBtn.enabled(self.nameFeild.text.length0self.phoneFeild.text.length0); 47 NSLog(通知调用的事件); 48 } 49 50 //临终遗言 51 -(void)dealloc 52 { 53 [[NSNotificationCenter defaultCenter] removeObserver:self]; 54 } 55 56 57 - (void)viewDidAppear:(BOOL)animated 58 { 59 // 3.主动召唤出键盘 60 [self.nameFeild becomeFirstResponder]; 61 // [self.nameField resignFirstResponder]; 62 } 63 64 65 - (IBAction)addBtnOnclick:(id)sender { 66 67 //点击添加按钮后把数据保存到模型数组中 68 //跳转 69 [self.navigationController popViewControllerAnimated:YES]; 70 71 //1.把当前界面文本框中的信息保存到模型中 72 YYInfoModel *info[[YYInfoModel alloc]init]; 73 info.nameself.nameFeild.text; 74 info.phoneself.phoneFeild.text; 75 76 //2.数据逆传把当前控制器view的数据传递到上一个控制器的view中 77 //使用代理自定义一个代理并使用代理传递数据 78 //如果代理方法存在就通知代理调用该方法传递数据 79 if ([self.delegate respondsToSelector:selector(addViewControllerDidAddBtn:contatc:)]) { 80 NSLog(sadafaf); 81 [self.delegate addViewControllerDidAddBtn:self contatc:info]; 82 } 83 84 NSLog(dddd); 85 } 86 end 二、效果 注销的弹窗效果      添加信息 信息添加后返回到联系人列表界面 转载于:https://www.cnblogs.com/dondre/p/4094633.html
http://wiki.neutronadmin.com/news/40254/

相关文章:

  • 站长工具下载appdede免费模板教育网站
  • 房地产网站策划书wordpress xml导入
  • 一起做网站注册地址大连网站建设好的公司
  • 怎么制作网站详细流程建网站能挣钱吗
  • 上海网站seo诊断装潢设计学校有哪些
  • 网站 自助建站wordpress vip会员插件
  • 建立网站 多少钱广东网页空间购买
  • 上海交通大学网站建设服务公司沈傲芳
  • 购物网站建设怎么样官方网站建设银行年利息是多少钱
  • 广州市官网网站建设公司香河县做网站
  • 用jquery做网站好吗徐州市工程招标网
  • 网站设计的国际专业流程是什么乐山的网站建设公司
  • 网站建设公司广告语宣传语优化网站的网站
  • 建设信息门户网站的条件浙江建设干部学校网站首页
  • 怎么建商城网站吗北票网站建设
  • 做企业网站进行推广要多少钱建邺做网站价格
  • 如何自己弄个免费网站网站建设需要找工信部吗
  • 怎样做网站网站唐山正规做网站的公司
  • 1万网站建设费入什么科目直播视频素材
  • wordpress电影站数据下载网站域名空间一年费用是多少钱
  • 学校网站怎么做的做pc网站会连带手机版
  • 肥料网站建设 中企动力铜陵高端网站建设
  • 怎么做网站的百度收录dedecms官网
  • 沧州南皮网站建设公司怎么做ppt
  • 网站ip地址是什么网站建设收获与体会
  • 鹿邑建设局官方网站设计绘图软件
  • 网站建设技术分析邢台关键词优化公司
  • 昆明微网站搭建哪家好企业做外贸网站常用术语
  • 东莞寮步网站建设网络公司成都响应网站建设
  • 建立网站的请示吉林网站开发