首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏iOS 开发杂谈

    九宫格常用的宏

    (SUPERVIEW,WIDTH,COLUMN) SUPERVIEW.subviews.count % COLUMN * WIDTH /** 设置格子的Y坐标 * SUPERVIEW 指九宫格每个小格子的父视图 (SUPERVIEW,HEIGHT,COLUMN) SUPERVIEW.subviews.count / COLUMN * HEIGHT /**************************有间距* ,WIDTH,COLUMN,MARGIN) SUPERVIEW.subviews.count % COLUMN * WIDTH + SUPERVIEW.subviews.count % COLUMN ,HEIGHT,COLUMN,MARGIN) SUPERVIEW.subviews.count / COLUMN * HEIGHT + SUPERVIEW.subviews.count / COLUMN ,WIDTH,COLUMN,MARGIN) SUPERVIEW.subviews.count % COLUMN * WIDTH + (SUPERVIEW.subviews.count % COLUMN

    68630发布于 2019-02-25
  • 来自专栏移动端周边技术扩展

    iOS11 UIBarButtonItem无法偏移问题坑

    [view isKindOfClass:UINavigationBar.class] && view.superview) { view = [view superview]; if ([view isKindOfClass:UIStackView.class] && view.superview) { if (self.position == SXBarViewPositionLeft ) { for (NSLayoutConstraint *constraint in view.superview.constraints) { removeConstraint:constraint]; } } [view.superview removeConstraint:constraint]; } } [view.superview

    1.8K70发布于 2018-06-15
  • 来自专栏王大锤

    iOS11UINavigationBar的item左右间距调整

    [view isKindOfClass:[UINavigationBar class]] && [view superview] ! = nil) { view = [view superview]; if ([view isKindOfClass:[UIStackView class]] && [view superview] ! [view isKindOfClass:[UINavigationBar class]] && [view superview] ! [view superview] !

    3.6K50发布于 2018-05-17
  • 来自专栏王大锤

    iOS11UINavigationBar的item左右间距调整

    [view isKindOfClass:[UINavigationBar class]] && [view superview] ! = nil) { view = [view superview]; if ([view isKindOfClass:[UIStackView class]] && [view superview] ! [view isKindOfClass:[UINavigationBar class]] && [view superview] ! [view superview] !

    1.9K30发布于 2018-07-04
  • 来自专栏iOS122-移动混合开发研究院

    Masonry -- 使用纯代码进行iOS应用的autolayout自适应布局

    (superview.mas_bottom).offset(-padding.bottom); make.right.equalTo(superview.mas_right).offset(-padding.right ); }]; 甚至可以更短: [view1 mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.equalTo(superview + 5, left = superview.left + 10, // bottom = superview.bottom - 15, right = superview.right - 20 make.size.greaterThanOrEqualTo(titleLabel) //使 width = superview.width + 100, height = superview.height button1 make.center.equalTo(button1) //使 centerX = superview.centerX - 5, centerY = superview.centerY

    2.5K50发布于 2018-01-02
  • 来自专栏浮躁的喧嚣

    iOS-屏幕适配实现(Autoresizing)

    Autoresizing的各种组合预览 ** UIViewAutoresizingNone** view的frame不会随superview的改变而改变(这样的约束条件有冲突,会默认左间距和上间距固定 UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight view与其superView UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight view与其superView UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight view与其superView 的宽高比例维持不变,上下左右间距也随其superView的缩放而缩放 UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight

    84210编辑于 2023-11-22
  • 来自专栏码客

    iOS 打印视图结构

    前言 iOS的组件都是封装好的,又没法看源代码,所以我们不容易知道组件的结构,所以我们可以遍历所有的视图,打印出来,来查看结构 /** 打印层级结构 - parameter superView: view - parameter level: 0 */ static func printViewHierarchy(superView:UIView,level:Int? = 0) -> Void { let className = "\(superView.dynamicType)"; let frame = "\(superView.frame)"; { print("\t", terminator:"") } if let backgroundColor = superView.backgroundColor backgroundColor)]") }else{ print("\(className) \(frame) [背景色:透明]") } for sonView in superView.subviews

    85710发布于 2019-10-22
  • 来自专栏DannyHoo的专栏

    Masonry的使用之利用子视图撑起父视图

    可复制代码: UIView* superView = [[UIViewalloc]init]; [self.viewaddSubview:superView]; UIView* subView = [[UIViewalloc]init]; [superViewaddSubview:subView]; superView.backgroundColor = [UIColor greenColor offset(100); }]; [subViewmas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(superView.mas_left ).offset(10); make.top.equalTo(superView.mas_top).offset(10); make.right.equalTo(superView.mas_right ).offset(-10); make.bottom.equalTo(superView.mas_bottom).offset(-10); make.width.height.equalTo

    3.7K20发布于 2018-09-13
  • 来自专栏TechBox

    两个宏快速计算九宫格X、Y坐标

    /** 设置格子的X坐标 * SUPERVIEW 指九宫格每个小格子的父视图 * WIDTH 指九宫格每个小格子的宽度 int width = (VVS_SCREEN_WIDTH - (colunm ,WIDTH,COLUMN,MARGIN) SUPERVIEW.subviews.count % COLUMN * WIDTH + (SUPERVIEW.subviews.count % COLUMN + 1) * MARGIN /** 设置格子的Y坐标 * SUPERVIEW 指九宫格每个小格子的父视图 * HEIGHT 指九宫格每个小格子的高度 * COLUMN 指九宫格的纵向列数 ,HEIGHT,COLUMN,MARGIN) SUPERVIEW.subviews.count / COLUMN * HEIGHT + (SUPERVIEW.subviews.count / COLUMN 另外,使用这个宏时,一旦格子被创建出来就必须加到superView中,不能等到所有的格子都创建好后再一起加到父视图。 上面第一个宏是可以计算每个格子的X坐标。第二个宏可以计算每个格子的Y坐标。

    5.9K30发布于 2018-06-05
  • 来自专栏增长技术

    自动布局

    multiplier:(CGFloat)multiplier constant:(CGFloat)constant; Button.centerX = Superview.centerX NSLayoutAttributeCenterX relatedBy:NsLayoutRelationEqual toItem:superview NSLayoutAttributeCenterX multiplier:1.0 constant:0.0]; Button.bottom = Superview.bottom NSLayoutAttributeBottom relatedBy:NsLayoutRelationEqual toItem:superview Connection to Superview |-50-[purpleBox]-50-| ? 4.

    50520发布于 2018-09-06
  • 来自专栏岑志军的专栏

    Masonry

    * 1.0 + 10 UIView *superview = self.view; UIView *view1 = [[UIView alloc] init]; view1. translatesAutoresizingMaskIntoConstraints = NO; view1.backgroundColor = [UIColor greenColor]; [superview addSubview:view1]; UIEdgeInsets padding = UIEdgeInsetsMake(10, 10, 10, 10); [superview 对象回调给用户,让用户对constraintMaker对象的属性进行初始化,其中block(constraintMaker)就相当于我们直接在该方法内部调用make.left.mas_equalTo(superview ; return [constraintMaker install]; } 紧接着看下block回调回来的操作是如何进行的,也就是下面的这些代码: make.left.mas_equalTo(superview

    1.4K10发布于 2019-12-30
  • 来自专栏LinXunFeng的专栏

    iOS 面向协议封装全屏旋转功能

    = nil, superView: UIView? = nil, config: FullScreenableConfig? 指定即将全屏的视图 superView UIView? 作为退出全屏后specifiedView的父视图 config FullScreenableConfig? 进入/退出 全屏后的回调 当switchFullScreen的调用者为UIView时,如果specifiedView为nil会自动填写,superView也是如此 switchFullScreen = nil ) func exitFullScreen( superView: UIView, config: FullScreenableConfig? = nil ) func exitFullScreen( superView: UIView? = nil, config: FullScreenableConfig?

    1.4K60发布于 2018-10-10
  • 来自专栏iOS逆向与安全

    iOS14适配【解决UITableViewCell兼容问题(往cell添加子视图的方式不规范)】

    其他分析视图层级的方法:私有API _printHierarchy 和recursiveDescription 1.1 注意事项 II、使用方法交换,全局修改 2.2.1 cell.subviews 2.2.2 通过superview UIButton * btn = cell.contentView.subviews[2-1]; 2.2.2 通过superview 获取cell的也需做相关修改 经过全局hook之后,以下的代码就是错误的 (UITableViewCell *)[textField superview] 全局搜索进行修改 ? UITableViewCell * myCell = (UITableViewCell *)[textField superview].superview; 所以使用class的时候,最好写得健壮性强点 ,进行类型判断,避免一旦类型错误,就会找不到对应的方法,发送闪退 UIView * textFieldsuperview = [textField superview]; UITableViewCell

    3.1K20发布于 2021-01-18
  • 来自专栏云原生布道专栏

    IOS开发系列——UIView专题之四:事件分发机制篇【整理,部分原创】

    也就是说,如果你的Subview设置了clipsToBounds=NO,实际显示区域可能超出了superView的frame,你点击超出的部分,是不会处理你的事件的,就是这么任性! =self.superview; while(superView) { [spacesappendString:@"----"]; superView=superView.superview; =self.superview; while(superView) { [spacesappendString:@"----"]; superView=superView.superview; 举个例子,如果触摸通过hitTest确定的是一个View,而这个View没有处理事件,则事件会发送给nextResponder去处理,通常是superView,有关nextResponder的事件传递过程 (view.nextResponder= view.superView) 2、UIViewController的nextResponder是它直接管理的View的superView (VC. nextResponder

    1K10编辑于 2022-03-08
  • 来自专栏coding...

    iOS开发-RAC+MVVM练手项目 图床App写在前面准备工作界面设计首页历史关于后记

    uploadView mas_makeConstraints:^(MASConstraintMaker *make) { make.center.equalTo(uploadView.superview titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(titleLabel.superview successView mas_makeConstraints:^(MASConstraintMaker *make) { make.size.equalTo(successView.superview make.height.equalTo(successView).multipliedBy(0.6); make.centerX.equalTo(imageView.superview make.top.equalTo(imageView.mas_bottom).offset(scaleHeight(20)); make.centerX.equalTo(copyBtn.superview

    1.2K20发布于 2018-08-23
  • 来自专栏TechBox

    深入详解iOS适配技术

    UIViewAutoresizingFlexibleLeftMargin // 自动弹性的调整与superView左边的距离,保证与superView右边的距离不变。    UIViewAutoresizingFlexibleRightMargin // 自动弹性的调整与superView的右边距离,保证与superView左边的距离不变。    UIViewAutoresizingFlexibleTopMargin // 自动弹性d调整与superView顶部的距离,保证与superView底部的距离不变。    UIViewAutoresizingFlexibleBottomMargin // 自动弹性的调整与superView底部的距离,也就是说,与superView顶部的距离不变。    的宽高比例维持不变,上下左右间距也随其superView的缩放而缩放 ?

    9.6K70发布于 2018-06-05
  • 来自专栏一“技”之长

    iOS界面布局之二——初识autolayout布局模型

    :与父视图左边界的约束 Trailing Space to Superview:与父视图右边界的约束 Top Space to Superview:与父视图上边界的约束 Bottom Space to (2)选中1.重复上面步骤,选择Leading Space to Superview。这时1的左边又会增加一条线: ? 点击这条线,在右边的设置去将约束值设置为20: ? (3)重复上面步骤,选中视图2,添加Trailing Space to Superview约束。 (4)选中视图3,重复上面步骤。 (5)选中1和2,添加Horizontal Spacing,设置为20. (6)选中1和3,添加Vertical Spacing,设置为20. (7)为1和2分别添加Top Space to Superview (8)为3添加Bottom Space to Superview约束。 (9)选中1和3,添加Heights Equally约束。

    1.3K30发布于 2018-08-16
  • 来自专栏娱乐心理测试

    iOS 输入支付密码demo

    AnimationTimeInterval animations:^{ __strong typeof(weakSelf) strongSelf = weakSelf; strongSelf.superView.backgroundColor AnimationTimeInterval animations:^{ __strong typeof(weakSelf) strongSelf = weakSelf; strongSelf.superView.alpha completion:^(BOOL finished) { __strong typeof(weakSelf) strongSelf = weakSelf; [strongSelf.superView removeFromSuperview]; strongSelf.superView = nil; }]; } //输入密码或删除时 - (void)updateLabelBoxWithText

    2.6K50发布于 2019-07-01
  • 来自专栏猿人谷

    addSubView需要注意的几个点为什么要在addsubview:一个view对象后,release它?

    Discussion This method retains view and sets its next responder to the receiver, which is its new superview Views can have only one superview. If view already has a superview and that view is not the receiver, this method removes the previous superview before making the receiver its new superview.

    1.6K100发布于 2018-01-17
  • 来自专栏iOS122-移动混合开发研究院

    如何把设计图自动转换为iOS代码? 在线等,挺急的!

    . */ } - (UIViewController*)viewController { for (UIView* next = [self superview]; next; next = next.superview) { UIResponder* nextResponder = [next nextResponder]; if ([nextResponder = subView.superview; make.width.equalTo(superView).multipliedBy(subWidth / superWidth); make.height.equalTo(superView).multipliedBy(subHeight / superHeight); make.right.equalTo(superView = subView.superview; make.width.equalTo(superView).multipliedBy(subWidth

    2K60发布于 2018-01-02
领券