Saturday, 15 February 2014

ios - UIView not redrawing, but elements become misplaced -



ios - UIView not redrawing, but elements become misplaced -

i'm having issue app's layout bit tricky explain. when app first starts, i'm showing:

after user taps "create profile", animate buttons , show registration form instead:

needless say, buttons not in "natural" position. note, however, text fields - that's have placed them in storyboard, when view first loads hide them. animations working great, needed scroll view when user gives focus text field , keyboard hides field. details of how trigger bug bit hard explain, managed boil downwards seems redraw event, except isn't... allow me seek , explain that.

first of all, here's happens when keyboard show:

- (void)keyboardwillshow:(nsnotification*)notification { cgrect frame = self.view.frame; frame.size.height -= 1; self.view.frame = frame; }

notice test only, minimal found still trigger bug. resize view. expect view was, 1 less pixel, right? wrong. here's get:

that is, elements returned "natural" positions, ignoring previous positions. first guess seem window redrawing, tried this:

- (void)drawrect:(cgrect)rect { [super drawrect:rect]; nslog(@"view drawn"); }

but triggers when window first drawn, not when unusual behaviour happens. understand mean "natural position", here's have in storyboard:

you can see i'm not using constraints , underlying construction of view:

the total code entire setup quite extensive, pretty much not practical @ show. however, how animate subviews resumes changing frame did in keyboardwillshow, , setting positions whatever need.

any ideas?

so you're using storyboards , have "use autolayout" set false entire storyboard?

in case app using "struts , springs" style placement rules. you're going have debug those.

it's bit hard describe in view controller in post. it's easier go on in ib. perhaps can write utility function logs autoresizingmask values views in view controller, , go on those, , perhaps post them here describing autoresizingmask values each view in original post.

ios objective-c xcode uiview xcode-storyboard

No comments:

Post a Comment