objective c - Center the subview in UIView using constraints in IOS -
i have 3 subview subview1,subview2,subview3 in uiviewcontroller
inside uiview
.
i'm using constraints on them, constraints i'm using show in center when button clicked these,
- horizantally in container,
- vertically in container,
- width and
- height.
issue :
when run app , click button
once comes in right position. when dismiss , try again open it, subview
change position , comes on top left of uiviewcontroller
,
as can see in screen shot, want show view
every time when click button in center of uiviewcontroller
.
i'm confused constraints right why changes position when open again.
my code ,
- (ibaction)precord:(id)sender { _dateview.hidden=no; [self.dateview bounceintoview:self.view direction:dcanimationdirectionleft]; }
the contents in story board , enter image description here
it depends on way dismissing view. tried below code , worked me
- (ibaction)btn_tapped:(id)sender { _smallview.hidden = false; [_smallview bounceintoview:self.view direction:dcanimationdirectionleft]; } - (ibaction)hide_tapped:(id)sender { _smallview.hidden = true; }
basically hiding view. , when btn_tapped, everytime view displaying bouncing animation in center. let me know how go!
wiki
Comments
Post a Comment