ios - Prevent animation when dynamically resizing popover -
so realized myself , found answer confirm:
prevent contentsizeforviewinpopover animating
basically in similar boat in want dynamically resize popover, depending on how data have display. getting animation action popover view moves place. problem is, can't set popover's content size in caller/parent, because neither size of content view text view nor frame text view in popover known until viewdidappear or viewdidlayoutsubviews called, of course @ point it's late, popover on way being visible, getting unwanted animation.
i dynamically setting size of text views in popover view controller class fit amount of data text views displaying, , works @ point frame size defined/known/however want word when hasn't gotten point yet in view lifecycle.
i should mention have view controllers , view done in storyboard.
does make sense? hope i'm explaining well. or suggestions appreciated.
edit here viewdidlayoutsubviews method view controller loading in popover - makes clear. first time loads, if don't in viewdidlayoutsubviews or viewdidappear frame 2 text views cgrectzero, text views don't resize content correctly , popover size isn't right either:
- (void)viewdidlayoutsubviews { [super viewdidlayoutsubviews]; self.physiciandatanewvaluetextview.text = self.physiciandatanewvalue; cgrect frame = self.physiciandatanewvaluetextview.frame; frame.size.height = self.physiciandatanewvaluetextview.contentsize.height; self.physiciandatanewvaluetextview.frame = frame; self.physiciandataoldvaluetextview.text = self.physiciandataoldvalue; frame = self.physiciandataoldvaluetextview.frame; frame.size.height = self.physiciandataoldvaluetextview.contentsize.height; self.physiciandataoldvaluetextview.frame = frame; self.contentsizeforviewinpopover = cgsizemake(384.0f, self.physiciandataoldvaluetextview.frame.size.height + 75.0f); }
so decided use delegation. instead of resetting content size in view controller popover, call delegate (which containing view controller) new size can set there animated property set no. works well.
Comments
Post a Comment