iOS中NSNotificationCenter…
来源:互联网 发布:淘宝店铺免费装修教程 编辑:程序博客网 时间:2024/06/05 14:55
原文地址: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)
- 自定义UITableViewCell
- UIScrollView和UIPageControl的所…
- Xcode中添加图片文件报如下错误解…
- android使用C/C++调用SO库
- iOS中侧边栏的添加
- iOS中NSNotificationCenter…
- iOS 常见错误
- 应用第三方库EGORefreshTableHeaderView实现下拉刷新功能
- iOS学习之Table View的简单使用
- 图文解释XCode常用快捷键的使用
- iOS学习之分段Table View的使…
- struts的OGNL(1)
- 如何上传图片到iOS模拟器
- 怎样为你电脑的xcode装上coc…