【发布时间】:2014-05-02 12:49:42
【问题描述】:
我创建了一个xib,并通过以下代码将其显示在视图中。
NSArray *xibContents =
[[NSBundle mainBundle] loadNibNamed:@"PickupAddressView"
owner:self
options:nil];
UIView *view = [xibContents objectAtIndex:0]; // Safer than objectAtIndex:0
//UIView *subView=[view.subviews objectAtIndex:0];
[view setFrame:CGRectMake(0.0f, 0.0f, 0.0f, 0.0f)];
CGRect tempFrame=view.frame;
tempFrame.size.width=300;//change acco. how much you want to expand
tempFrame.size.height=350;
[UIView beginAnimations:@"" context:nil];
[UIView setAnimationDuration:0.2];
view.frame=tempFrame;
//[UIView commitAnimations];
[view setFrame:CGRectMake(10.0f, 90.0f, 300.0f, 350.0f)];
[view setBackgroundColor:
[UIColor colorWithPatternImage:
[UIImage imageNamed:@"Register_bg"]]];
[UIView commitAnimations];
[view removeFromSuperview];
[self.view addSubview:view];
我正在使用UIStoryboard,并制作了这个xib,并从以下代码中显示。
如何删除此视图。我有一个UIButton,正在调用它的IBAction。
谢谢
【问题讨论】:
-
remove UIView from superView 的可能重复项
-
你的答案只是点击了..为什么你只是试图搜索..很容易stackoverflow.com/questions/11355813/…
-
它工作正常,但我无法删除此视图
标签: ios objective-c storyboard xib superview