subivews
view A
,view B
,view C
的视图。view A
表示时,剩余的views
必须自动向上移动。 注意:不在autolayout
。请告诉automask
答案 0 :(得分:1)
它不会自动运行,你需要编程一下,你可以试试下面的代码来实现这个,
//Adding Delete Tap Gesture
-(void)addGestureToSubViews{
for(UIView *view in parent.subviews){
UITapGestureRecognizer *gesture=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(deleteAction:)];
[view addGestureRecognizer:gesture];
}
}
-(IBAction)deleteAction:(UITapGestureRecognizer *)sender{
UIView *view=sender.view;
[UIView animateWithDuration:.3 animations:^{
CGRect rect=view.frame;
rect.origin.x=view.superview.frame.size.width;
view.frame=rect;
} completion:^(BOOL finished) {
[self reArrangeSuperView:view.superview withDeletedViewFrame:view.frame];
[view removeFromSuperview];
}];
}
-(void)reArrangeSuperView:(UIView *)superView withDeletedViewFrame:(CGRect)frame{
for(UIView *view in superView.subviews){
CGRect rect=view.frame;
if(rect.origin.y>frame.origin.y){
rect.origin.y=frame.origin.y;
}
[UIView animateWithDuration:.3 animations:^{
view.frame=rect;
}];
}
}
我希望它有所帮助。
干杯。
答案 1 :(得分:0)
对于属性检查器中的那个,您必须隐藏视图,并且您想要推送哪个视图,您应该设置视图的-contentoffset属性。