ios - changing tableview height at runtime -


hlo, i'm creating menu tableview , toggling visibility on button click. i'm changing height actually.but changing height of tableview affecting tableview not cells inside it. tableview have shadow, if remove shadow works perfectly. please help. here code fragment

let _initialtableframe = cgrectmake(self.view.frame.size.width - 150, 68, 140, 0)     _topmenutableview = uitableview(frame: _initialtableframe)     _topmenutableview.delegate = self     _topmenutableview.datasource = self     _topmenutableview.rowheight = 35     _topmenutableview.tag = 100     _topmenutableview.alpha = 0.9     _topmenutableview.tablefooterview = uiview()     _topmenutableview.scrollenabled = false      _topmenutableview.layer.cornerradius = 5     _topmenutableview.layer.shadowcolor = uicolor.blackcolor().cgcolor     _topmenutableview.layer.shadowoffset = cgsizemake(0, 0)     _topmenutableview.layer.shadowradius = 5.0     _topmenutableview.layer.shadowopacity = 1  func toogletopmenu() {     if _istopmenuvisible     {         let _currenttopmenuframe = _topmenutableview.frame         let _tempframe = cgrectmake(_currenttopmenuframe.origin.x, _currenttopmenuframe.origin.y, _currenttopmenuframe.size.width, 0)           uiview.animatewithduration(0.2, animations: {self._topmenutableview.frame = _tempframe})         _istopmenuvisible = false     }     else     {         let _currenttopmenuframe = _topmenutableview.frame         let _tempframe = cgrectmake(_currenttopmenuframe.origin.x, _currenttopmenuframe.origin.y, _currenttopmenuframe.size.width, 38)          uiview.animatewithduration(0.2, animations: {self._topmenutableview.frame = _tempframe})         _istopmenuvisible = true     } } 

this because changing frame of tableview not tableviewcellheight

try this

    func toogletopmenu() {     if _istopmenuvisible     {         let _currenttopmenuframe = _topmenutableview.frame         let _tempframe = cgrectmake(_currenttopmenuframe.origin.x, _currenttopmenuframe.origin.y, _currenttopmenuframe.size.width, 0)          uiview.animatewithduration(0.2, animations: {self._topmenutableview.frame = _tempframe _topmenutableview.rowheight = //whatever height want assign _topmenutableview.reloaddate() })          _istopmenuvisible = false     }     else     {         let _currenttopmenuframe = _topmenutableview.frame         let _tempframe = cgrectmake(_currenttopmenuframe.origin.x, _currenttopmenuframe.origin.y, _currenttopmenuframe.size.width, 38)     uiview.animatewithduration(0.2, animations: {self._topmenutableview.frame = _tempframe _topmenutableview.rowheight = //whatever height want assign _topmenutableview.reloaddate() })     _istopmenuvisible = true } } 

it help.thanks


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -