使用野狗(Wilddog)云setValue写入数据
2016-04-05 18:08
441 查看
- (void)viewDidLoad { [super viewDidLoad]; //创建野狗实例化对象 用于随时监听数值变化 Wilddog *myRootRef = [[Wilddog alloc] initWithUrl:@"https://exile.wilddogio.com/weather"]; //监听键值 [myRootRef observeEventType:WEventTypeValue withBlock:^(WDataSnapshot *snapshot) { NSLog(@"%@ -> %@", snapshot.key, snapshot.value); }]; //为weather键赋初始值 [myRootRef setValue:@"Sunny"]; UIButton* btn1=[[UIButton alloc]initWithFrame:CGRectMake(20, 20, 100, 30)]; btn1.backgroundColor=[UIColor orangeColor]; [btn1 addTarget:self action:@selector(changeValue1) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:btn1]; UIButton* btn2=[[UIButton alloc]initWithFrame:CGRectMake(20, 70, 100, 30)]; btn2.backgroundColor=[UIColor orangeColor]; [btn2 addTarget:self action:@selector(changeValue2) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:btn2]; } -(void)changeValue1 { Wilddog *myRootRef = [[Wilddog alloc] initWithUrl:@"https://exile.wilddogio.com/weather"]; [myRootRef setValue:@"Snow"]; } -(void)changeValue2 { Wilddog *myRootRef = [[Wilddog alloc] initWithUrl:@"https://exile.wilddogio.com/weather"]; [myRootRef setValue:@"Wind"]; }
相关文章推荐
- lintcode-medium-Segment Tree Query II
- 【iOS】使用UIView绘制本地验证码
- lintcode-medium-Segment Tree Query
- What's the difference between all the Selection Segues?
- 【iOS】UILabel多行文本的高度计算
- lintcode-medium-Segment Tree Build II
- lintcode-medium-Segment Tree Build
- Material Design UI Widgets —— Palette 调色板
- 大作业关于(“有爱”youi)的简介
- mysql5中大数据错误:Packet for query is too large (1117260 > 1048576). You can change this value on the ser
- 将UIDatePicker的日期显示为数字和中文
- Material Design UI Widgets —— CardView 卡片视图
- CodeForces 618B-Guess the Permutation【搜索】
- NSURLConnection的sendAsynchronousRequest
- iOS开发学习笔记——控制器(UIViewController)
- HDU 1242 Rescue dfs
- [ios] dispatch_get_main_queue 的同步异步问题
- Meterial Design UI Widgets —— RecyclerView 循环视图
- Android4.4 Systemui状态栏状态图标更新流程分析
- LeetCode 63 - Unique Paths II