iOS中NSNotificationCenter…
来源:互联网 发布:parsley.min.js 编辑:程序博客网 时间:2024/06/05 19:21
原文地址:iOS中NSNotificationCenter实现主题背景更换作者:伤心的小果冻
创建一个baseViewController
然后所有的子视图都继承于该视图控制器,主题思想是baseViewController的背景颜色改变后,所有的子视图控制器的背景颜色也随之改变
在想修改主题背景的地方加入以下代码
[[NSNotificationCenterdefaultCenter]postNotificationName:@"BGCOLOR_CHANGED" object:[UIColor colorWithRed:rgreen:g blue:balpha:1]];
r,g,b是你修改的颜色的三基色值(可以用slider设置相应的r,g,b值)
然后在baseViewController的init方法中添加以下代码:
[[NSNotificationCenterdefaultCenter]addObserver:selfselector:@selector(setBGColor:) name:@"BGCOLOR_CHANGED" object:nil];
并添加方法
-(void)setBGColor:(NSNotification *)noti
{
}
- iOS中NSNotificationCenter…
- iOS中NSNotificationCenter…
- iOS中NSNotificationCenter…
- ios NSNotificationCenter
- IOS NSNotificationCenter
- [IOS] NSNotificationCenter
- IOS:NSNotificationCenter
- IOS NSNotificationCenter
- iOS中NSNotificationCenter的简单使用
- IOS中通知中心(NSNotificationCenter)的使用
- IOS中通知中心NSNotificationCenter应用总结
- IOS中通知中心(NSNotificationCenter)的使用
- iOS中通知的使用NSNotificationCenter
- iOS中通知中心NSNotificationCenter应用总结
- iOS中通知的使用NSNotificationCenter
- iOS中通知中心NSNotificationCenter应用总结
- iOS中通知中心NSNotificationCenter应用总结
- iOS通知中心传值实现(NSNotificationCenter)(2)
- UITabBarController使用详解
- iOS单例模式的实现
- iOS上常用四种数据存取方法
- 在ios中设置UINavigationBar的背景…
- iOS中侧边栏的添加
- iOS中NSNotificationCenter…
- 关于 下拉刷新EGORefre…
- 我已率先抢占昵称,我的昵称独一无…
- UIView的常用操作 详细说明
- CGContextRef用法
- cocos2d-x中CCArray使用时注…
- cocos2d-x CCLabelTTF 描边
- iOS中地图的添加(定位、划…
- 分享b2b企业优化EDM邮件营销小技巧