`
sxtygyxy
  • 浏览: 2461 次
社区版块
存档分类
最新评论

addSubview insertSubview

    博客分类:
  • Ios
Ios 
阅读更多
addSubview是一层一层往上加,新加的只能放到父视图的最上层,

insertSubView可以控制它添加到父视图的哪一层

A addSubview B  是将B直接覆盖在A的最上层

A insertSubView B AtIndex:2 是将B插入到A的子视图index为2的位置(最底下是0)

A insertSubView B aboveSubview:C  是将B插入A并且在A已有的子视图C的上面

A insertSubView B belowSubview:C  是将B插入A并且在A已有的子视图C的下面
分享到:
评论

相关推荐

    IOS7下可AddSubView的AlertView

    在解决关于IOS7下Alert不能再AddsubView的问题时候,弄到的解决方法。用法基本和原来的UIAlertView一样 dismiss 用 close实现了

    Swift仿Twitter的导航条和页面

    self.navbarView.addSubview(navTitleLabel1) navTitleLabel2 = UILabel() navTitleLabel2.frame = titleSize navTitleLabel2.text = "Discover" navTitleLabel2.textAlignment = NSTextAlignment.Center ...

    ios-获取验证码按钮.zip

    self.view.addSubview(codeButton) codeButton.doneSend { print("codeButton 已发送") } OC: XFetchCodeButton * button = [[XFetchCodeButton alloc] initWithFrame:CGRectMake(20, 100, 100, 50)]; ...

    ios-封装设置安全区域代码.zip

    [self.view addSubview:view]; view.backgroundColor = [UIColor yellowColor]; //设置contentview,四边都在安全区域 [self am_makeSafeView:view]; UIButton *butt new]; button.backgroundColor = [UIColor...

    ios-闪烁的文字,多种闪烁效果.zip

    [self.view addSubview:label1]; WSShiningLabel *label2 = [[WSShiningLabel alloc] init]; label2.frame = CGRectMake(50, 105, 200, 25); label2.text = @"变成要你保护的她"; label2.textColor = ...

    (0012)-iOS/iPhone/iPAD/iPod源代码-导航条(Navigation Bar)-Wood UINavigation

    在iOS5.0以上版本,要想navigation bar上面也能显示木质图片,要更改“WoodUINavigationAppDelegate.m”文件的一段代码:[navigationController.navigationBar insertSubview:imageView atIndex:0];改成:...

    iOS 各种动画

    [self.view addSubview:imageView]; //Twitter style splash SKSplashIcon *twitterSplashIcon = [[SKSplashIcon alloc] initWithImage:[UIImage imageNamed:@"twitterIcon.png"] animationType:...

    ios-DCHChangeStateButton.zip

    自定义一个菜单按钮,通过切换按钮状态,对列表数据进行排序,直接调用即可 for (int i = 0;... [view addSubview:conditionBtn]; [self.view addSubview:view]; [self.btnArr addObject:conditionBtn]; }

    长按拖动排序

    // [self.view addSubview:stBtn]; // stBtn.buttonArray = [[NSMutableArray alloc]init]; // for (NSInteger i = 0; i ; i++) { // UIButton *btn = [[UIButton alloc]initWithFrame:CGRectMake(i*375/4.0, 0, 375...

    eVolumeBar:一个项目,该项目用无阻塞,可自定义的iOS Volume HUD替换了默认的iOS Volume HUD。

    eVolumeBar eVolumeBar用较少干扰和更人性化的视图替换了默认的iOS卷HUD。 用法 将源文件添加到您的xcode项目中,并将eVolumeBar视图添加到您现有的视图中。 (请查看下面的示例或检查smaple... addSubview (volume)

    ios-点击切换状态の按钮Multi-Button.zip

    [self.view addSubview:btn]; ② MultiButton *btn = [[MultiButton alloc]initWithFrame:CGRectMake(0, 0, 200, 30)]; btn.center = CGPointMake(self.view.center.x, 300); [btn setName:@"volume" state:...

    ios-JDLayout-超简易的约束布局.zip

    [self.view1 addSubview:label1]; UILabel *label2 = [[UILabel alloc] init]; label2.text = @"我是垂直平分2"; label2.backgroundColor = [UIColor blueColor]; label2.textAlignment = NSTextAlignmentCenter; ...

    IOS点赞效果按钮源代码下载

    #import "CatZanButton" ...[self.view addSubview:zanBtn]; [zanBtn setClickHandler:^(CatZanButton *zanButton) { if (zanButton.isZan) { //Do something }else{ //Do something } }];

    归档操作,源码

    归档操作,源码,详细标注,值得拥有,, CustomImgView *customView = [[CustomImgView alloc]initWithFrame:CGRectMake(50, 100, 200, 200)]; customView.backgroundColor =... [self.view addSubview:customView];

    ios-CRBoxInputView.zip

    支持iOS12短信验证码自动填充。 支持密文输入。 支持密文自定义符号。...[self.view addSubview:boxInputView]; 其他用法请查看github主页:https://github.com/CRAnimation/CRBoxInputView

    ios-iOS自定义视频播放器(avPlayer简易版).zip

    JWAVPlayer 自定义简单的支持横屏竖屏切换的Avplayer ```javascript JWPlayer*player=[[JWPlayer ... [self.view addSubview:player]; ``` [git地址](https://github.com/JarvisHot/JWAVPlayer) 给个star呗

    02-通过代码创建按钮

    [self.view addSubview:btn]; // 3.设置frame btn.frame = CGRectMake(50, 50, 100, 100); // 4.设置背景图片 // 4.1通过文件名加载图片(凡事PNG图片,不用加拓展名) UIImage *normal = [UIImage imageNamed:@...

    ios-LGLSearchBar.zip

    这个是根据我们平时常用的搜索框,对UISearchBar进行了封装,可以更改里面的很多属性,具体见代码 ,代码也可到github下载:https://github.com/liguoliangiOS/LGLSearchBar.git ... [self.view addSubview:searchBar];

    ios-水波图;支文字在2种颜色之间交换显示;.zip

    [self.view addSubview:self.percentView]; //设置进度: [self.percentView setupProgress:(arc4random()0)/100.00]; //具体细节: static CGFloat kWaterViewMaxHeight = 200; static CGFloat ...

    ios-下拉菜单.zip

    _dataArr = [NSMutableArray arrayWithObjects:@"休假",@"保养",@"维修", nil]; menu=[[DrawMenu alloc]initWithFrame:CGRectMake(26, self.applyType.frame.origin.y, _applyType.... [self.view addSubview:menu];

Global site tag (gtag.js) - Google Analytics