`
啸笑天
  • 浏览: 3430905 次
  • 性别: Icon_minigender_1
  • 来自: China
社区版块
存档分类
最新评论

addSubview和insertSubview的区别

 
阅读更多

 

addSubview 是将view加到所有层的最顶层

相当于将insertSubview的atIndex参数设置成view.subviews count

[view addSubview:oneview] == [view insertSubview:oneview atIndex:view.subviews count]

 

addSubview是加到最后
insertSubview是加到指定的位置
分享到:
评论

相关推荐

    IOS7下可AddSubView的AlertView

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

    Swift仿Twitter的导航条和页面

    Swift仿Twitter的导航条和页面,可以自定义页面数量。 // // PagingNavController.swift // SwiftPagingNav // // Created by Aubrey & Chad on 10/31/14. // Copyright (c) 2014 Aubrey Johnson / Chad Timmerman. ...

    ios-获取验证码按钮.zip

    有OC版本和Swift版本,git地址: https://github.com/ZHShare/XFetchCodeButton.git // 部分代码 Swift: let codeButton = XFetchCodeButton(frame: CGRect(x: 20, y: 100, width: 100, height: 50)) ...

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

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

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

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

    iOS 各种动画

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

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

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

    ios-ZLDropdownMenu.zip

    后续会抽时间在git中添加更多功能 ZLDropDownMenu *menu = [[ZLDropDownMenu alloc...遵守代理ZLDropDownMenuDelegate和数据源ZLDropDownMenuDataSource,并按照ViewController中设置即可,使用方法和UITableview相似

    ios-DCHChangeStateButton.zip

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

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

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

    ios-UIExPickerView.zip

    只需要传入数组和frame即可得到选择的数据,不需要修改任何代码...[self.view addSubview:pView]; //回调方法 (void)selectIndex:(NSInteger)index { //根据索引取出传入数组的值 NSLog(@"%ld",(long)index); }

    长按拖动排序

    // [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...

    UIScrollView定时滚动和循环滚动,可点击图片和PageController

    定时滚动和循环滚动,可点击图片和PageController #import "ASIFormDataRequest.h" #import "GWPublicClass.h" @interface ViewController () @end @implementation ViewController { UIScrollView * ...

    ios-一个简单的类似于系统UIAlerView.zip

    无聊的时候写的一个类似于系统的alertview,有个小小的动画,只有取消和确定键,代码只供参考,不建议项目使用 使用方法 XCJAlert *popView = [[XCJAlert alloc]initWithFrame:self.view.bounds withTitle:@"我是...

    完全自定义UITabBarController里的标签样式

    iOS object-C 自定义封装成 和 UITabBarView一样的功能。主要体现在 UITabBar样式上,可以随意修改 继承UITabBarController 写的 管理切换控制器 主要是写 UITabBar样式是 继承UIView //标签栏 _bottomBar = [...

    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地址和地区选择

    内有demo ipad版本,iPhone可能存在适配问题。 另附有封装好的文件(地区选择) ... [self.view addSubview:ck]; [ck setMeiNv:^(NSMutableArray *ary ) { NSLog(@"%@ == %@",ary[0],ary[1]); }];

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

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

    DRWindowController:一个用于管理UIViews和UIViewControllers层的Objective-C CocoaTouch类。 这很有用,因为Cocoa Touch不允许您创建多个UIWindows。

    DRWindowController通过为您调用addChildViewController:和addSubView:来处理添加UIViewControllers的所有addSubView: 。 使用CocoaPods进行安装 是Objective-C的依赖项管理器,它可以自动化并简化在项目中使用诸如...

    ios-QZCommentTextView.zip

    封装类网易新闻评论新闻输入框,监听键盘改变显示高度,自带黑灰...使用几个设置颜色字体等工具,使用需要连带一些文件和pch,即CommonTools文件中所有文件 有时间会逐步把这些文件从工程中剥离出来,减小封装体积

Global site tag (gtag.js) - Google Analytics