[英]View get unhide automatically in iOS
I have created a view on interface & reducing its height on click of a button with uianimation.Below is the code for the animation我在界面上创建了一个视图,并在单击带有 uianimation 的按钮时降低了它的高度。下面是动画的代码
@IBAction func filterClick(sender: AnyObject) {
STF_Search.resignFirstResponder()
UIView.animateWithDuration(0.3, animations:{
if(self.isFilter==false){
self.filterView.frame=CGRectMake(0,117,self.view.frame.size.width,50)
self.STVRA.frame=CGRectMake(0, 168,self.STVRA.frame.size.width,self.STVRA.frame.size.height)
self.isFilter=true
}
else{
self.filterView.frame=CGRectMake(0,117,self.view.frame.size.width,0)
self.tableView.frame=CGRectMake(0, 117,self.STVRA.frame.size.width,self.STVRA.frame.size.height)
self.dateTo="nil"
self.dateFrom="nil"
self.isControlls(true)
self.isFilter=false
}
}
,completion: {(_) -> Void in
if(self.isFilter==true){
self.isControlls(false)
}
else{
self.callRAListWebApi()
}
})
}
Code working perfectly if I don't call the method "self.callRAListWebApi()" on the other hand in above scenario when execution of this methods complete the "filterView" gets into its default height-> 50 which is not supposed as per the logic it should be "0" ("callRAListWebApi" is a method where I am hitting a web api & getting some json response) I cant understand this unusual behaviour of "filter view" of coming in its original height.I have checked everything there is no clue.如果我在上述场景中不调用方法“self.callRAListWebApi()”,则代码工作完美逻辑它应该是“0”(“callRAListWebApi”是一种方法,我在其中点击了 web api 并获得了一些 json 响应)我无法理解这种不寻常的“过滤器视图”行为,即进入其原始高度。我已经检查了那里的所有内容是没有线索。
创建视图的autolayout
,因为问题是因为您正在直接更改框架。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.