【代码笔记】iOS-removeFromSuper
生活随笔
收集整理的這篇文章主要介紹了
【代码笔记】iOS-removeFromSuper
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
代碼:
RootViewController.m
- (void)viewDidLoad {[super viewDidLoad];// Do any additional setup after loading the view. self.title=@"removeFromSuperView"; UILabel *tryLabel=[[UILabel alloc]initWithFrame:CGRectMake(50, 150, 200, 50)]; tryLabel.backgroundColor=[UIColor redColor]; [self.view addSubview:tryLabel]; } //當點擊任意處時,把UILabel去掉 -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [self removeFromView]; } -(void)removeFromView { //點擊后刪除之前的PickerView for (UIView *view in self.view.subviews) { if ([view isKindOfClass:[UILabel class]]) { [view removeFromSuperview]; } } }轉載于:https://www.cnblogs.com/yang-guang-girl/p/6991253.html
總結
以上是生活随笔為你收集整理的【代码笔记】iOS-removeFromSuper的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 第十六周工作总结
- 下一篇: createTextRange 创建文本