iOS 在自定义tabbar上显示购物车的数量
2017-06-28 11:52
417 查看
//通过通知获取值
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary
*)launchOptions {
// Override point for customization after application launch.
self.window = [[UIWindowalloc]initWithFrame:[UIScreenmainScreen].bounds];
self.window.backgroundColor
= [UIColorwhiteColor];
[self.windowmakeKeyAndVisible];
[[NSNotificationCenterdefaultCenter]addObserver:selfselector:@selector(getShopCarNumberActio
4000
n:)name:@"getShopCarNumber"object:nil];
returnYES;
}
#pragma mark - 获取购物车的值
-(void)getShopCarNumberAction:(NSNotification *)noti
{
NSDictionary * dic = [notiuserInfo];
//self.numberLabel为在tabber上显示购物车数量的UILabel
self.numberLabel.text = [dicobjectForKey:@"shopCarNumber"];
}
#pragma mark - 加入购物车的点击按钮事件
-(void)buttonAction
{
[[NSNotificationCenter defaultCenter]postNotificationName:@"getShopCarNumber" object:nil userInfo:@{@"shopCarNumber":@"45"}];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary
*)launchOptions {
// Override point for customization after application launch.
self.window = [[UIWindowalloc]initWithFrame:[UIScreenmainScreen].bounds];
self.window.backgroundColor
= [UIColorwhiteColor];
[self.windowmakeKeyAndVisible];
[[NSNotificationCenterdefaultCenter]addObserver:selfselector:@selector(getShopCarNumberActio
4000
n:)name:@"getShopCarNumber"object:nil];
returnYES;
}
#pragma mark - 获取购物车的值
-(void)getShopCarNumberAction:(NSNotification *)noti
{
NSDictionary * dic = [notiuserInfo];
//self.numberLabel为在tabber上显示购物车数量的UILabel
self.numberLabel.text = [dicobjectForKey:@"shopCarNumber"];
}
#pragma mark - 加入购物车的点击按钮事件
-(void)buttonAction
{
[[NSNotificationCenter defaultCenter]postNotificationName:@"getShopCarNumber" object:nil userInfo:@{@"shopCarNumber":@"45"}];
}
相关文章推荐
- iOS实现自定义购物车角标显示购物数量(添加商品时角标抖动 Vie)
- IOS导航tabbar 自定义图片显示
- [ecshop 资料 经过检验 推荐]ECSHOP自定义任意位置显示购物车免刷新显示数量的代码
- ios 地图大头针自定义显示图片 MKAnnotationView
- IOS 7 自定义的UIAlertView不能在iOS7上正常显示
- ECSHOP全站调用购物车显示商品图片,价格,数量,总价等详细信息
- ios 自定义cell右侧的图片显示
- ios开发之在iOS应用中加载自定义字体显示
- ios学习笔记----实现一个带滑动手势的tabBarViewController,并可自定义tabBar
- IOS 7 自定义的UIAlertView不能在iOS7上正常显示
- ECSHOP全站调用购物车显示商品图片,价格,数量,总价等详细信息
- iOS开发笔记--cell最右边显示箭头,字符,自定义分割线
- ios开发笔记之 自定义tabBar
- iOS-快速自定义UITabBarController内的tabbar控件
- iOS:TabBarController 显示/隐藏第一级页面的TabBar
- IOS开发笔记_4自定义TabBar
- iOS 自定义选项卡控件(TabBar)的制作思路
- WordPress使用自定义字段设置缩略图和显示作者文章数量和评论数量代码
- IOS之自定义tabbar
- 关于iOS tabBar隐藏和显示问题