DJSelectCityViewController.h

// 点击城市发出通知
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // 1. 发送点击的城市名
DJCityGroup *cityGroup = self.cityGroups[indexPath.section];
[[NSNotificationCenter defaultCenter] postNotificationName:DJCityDidChangeNotification object:nil userInfo:@{DJSelectCityName:cityGroup.cities[indexPath.row]}]; // 2. 关闭当前controller
[self dismissViewControllerAnimated:YES completion:nil]; }

DJHomeViewController.m

/** 监听到城市改变广播 */
- (void)onReceiveCityChangeNotification:(NSNotification *)notification { NSString *selectedCityName = notification.userInfo[DJSelectCityName]; // 1. 更新当前显示地区
DJNavItem *areaView = self.areaItem.customView;
[areaView setTitle:[NSString stringWithFormat:@"%@ - 全部",selectedCityName]]; }

DJConstantValue.m

#import <Foundation/Foundation.h>

/* 通知 */
NSString *const DJCityDidChangeNotification = @"DJCityDidChangeNotification";
NSString *const DJSelectCityName = @"DJSelectCityName";

美团HD(9)-监听点击城市的更多相关文章

  1. IOS之UI--自定义按钮实现代理监听点击事件

    前言: Objective-C提供的按钮监听事件的方法是 不含参数的监听方法 [button实例对象 addTarget:self action:@selector(func) forControlE ...

  2. Android监听点击事件实现的三种方法

    监听点击事件实现的三种方法:1.匿名内部类2.外部类3.直接实现接口 1.匿名内部类: package com.jereh.calculator; import android.content.Con ...

  3. swift项目第六天:中间发布按钮的封装以及监听点击事件

    import UIKit /* 总结:1:给UIButton写分类,新建文件swiftFile,一般为了区分起名字都是名字-Extension,要想调用UI控件需要导入 import UIKit框架, ...

  4. js_微信分享,监听点击分享,分享成功,取消分享,分享失败回调

    2017-06-13 见代码: function weixinShare() { var links = links = "www.youku.com"; common.get_o ...

  5. layui comfirm 监听点击确定、取消、“X”关闭按钮

    layer.confirm('数据已存在,是否继续', { offset: '200px' , cancel: function (index, layero) { console.log('点击X按 ...

  6. android适配器及监听点击和滚动在ListView中的使用

    package com.example.demon08; import java.util.ArrayList;import java.util.HashMap;import java.util.Li ...

  7. recyclerview 主活动里监听点击事件

    记性真的不行啊...贴上来有时间多复习复习 主活动 package com.example.com.webtext; import android.content.Intent; import and ...

  8. android设置软键盘搜索键以及监听搜索键点击时发生两次事件的问题解决

    在输入框中加入android:imeOptions="actionSearch",调用软键盘时,回车键就会显示搜索二字. 我想在点击搜索时,跳转到下一个页面,但是调用setOnKe ...

  9. Android监听Button和ImageButton控件的点击事件

    一.onClick事件 Button和ImageButton都有一个onClick事件,通过自身的.setOnClickListener(OnClickListener)方法添加点击事件 所有的控件都 ...

随机推荐

  1. 【找规律】URAL - 2069 - Hard Rock

    题解及证明:http://www.cnblogs.com/StupidBoy/p/5241258.html #include<cstdio> #include<algorithm&g ...

  2. 【枚举】【权值分块】bzoj1112 [POI2008]砖块Klo

    枚举长度为m的所有段,尝试用中位数更新答案. 所以需要数据结构,支持查询k大,以及大于/小于 k大值 的数的和. 平衡树.权值线段树.权值分块什么的随便呢. #include<cstdio> ...

  3. python操作mysql封装成类

    import pymysqlimport loggingimport sys # 加入日志#获取logger实例logger = logging.getLogger("baseSpider& ...

  4. Android证书验证存漏洞 开发者身份信息可被篡改(转)

    原帖地址:http://bbs.pediy.com/showthread.php?p=1335278#post1335278 近期在国内网易,雷锋网等网站爆出谷歌市场上的索尼官方的备份与恢复应用&qu ...

  5. sql server博客

    SQLSERVER MSDN论坛 SQLSERVER 补丁博客 SQLSERVER中国研发中心 微软亚太区数据库技术支持组官方博客 PAUL的SQLSKILL网站 sqlsaturday网站 sqls ...

  6. Inno Setup 注册表启动项 修改注册表

      //注册表启动项 [Registry] Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ...

  7. zk watch机制及创建node机制

    Watch(监视) 当指定的znode或znode的子数据更改时,监视器会显示通知.你只能在 get 命令中设置watch. 语法 get /path [watch] 1 示例 get /FirstZ ...

  8. zk介绍

    1. 配置管理 Zookeeper提供了这样的一种服务:一种集中管理配置的方法,我们在这个集中的地方修改了配置,所有对这个配置感兴趣的都可以获得变更.这样就省去手动拷贝配置了,还保证了可靠和一致性. ...

  9. 【js 正则表达式】记录所有在js中使用正则表达式的情况

    说实话,对正则表达式有些许的畏惧感,之前的每次只要碰到需要正则表达式去匹配的情况,都会刻意的躲过或者直接从度娘处获取. 此时此刻,感觉到了某一个特定的点去触及她.但笔者对于正则表达式使用上的理解是这样 ...

  10. RabbitMq_05_Topics

    Topics (using the .NET client) Prerequisites This tutorial assumes RabbitMQ isinstalled and running ...