联系人:石虎QQ: 1224614774 昵称:嗡嘛呢叭咪哄
-(void)viewWillAppear:(BOOL)animated {
[superviewWillAppear:animated];
self.view.backgroundColor= [UIColorwhiteColor];
#warning效果图一:
//懒加载,将切换城市按钮拿到最上层
[self.viewbringSubviewToFront:self.changeCityBtn];//将子视图在前面
#warning效果图二:
//用第二层子视图换第一层子视图的位置,self.view是第0层
//[self.view exchangeSubviewAtIndex:2 withSubviewAtIndex:1];
}
//changeCityBtngetter方法实现
-(UIButton*)changeCityBtn {
if(!_changeCityBtn) {
_changeCityBtn= [UIButtonbuttonWithType:UIButtonTypeCustom];
_changeCityBtn.frame=CGRectMake(kScreenWidth-44-10,20,44,44);
_changeCityBtn.imageEdgeInsets=UIEdgeInsetsMake(8,8,8,8);
[_changeCityBtnsetImage:[UIImageimageNamed:@"location_hardware"]forState:UIControlStateNormal];
[self.viewaddSubview:_changeCityBtn];
[_changeCityBtnaddTarget:selfaction:@selector(changeCity)forControlEvents:UIControlEventTouchUpInside];
}
return_changeCityBtn;
}