首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏非典型技术宅

    UIScrollView的一步步实现1 简介1.1 工作原理1.2 UIScrollView常见的几个重要控件1.3 UIScrollView常见的重要属性1.4 手工代码实现拖动2 三个重要属性的进

    发生了变化 1.2 UIScrollView常见的几个重要控件 UITableView UICollectionView UITextView 1.3 UIScrollView常见的重要属性 属性名 作用 contentSize 的范围,不会滚动 如果指定的区域超越了当前可视区域,但没有超出contentSize的区域,可以滚动 -(void)scrollRectToVisible:(CGRect)rect animated :(BOOL)animated; 2.2 contentSize contentSize 的数值比scrollView自己的size大的时候才可以滚动 scrollView 要滚动就必须设置了滚动视图的 contentSize contentSize 的 width 决定了水平方向滚动距离 contentSize 的 height 决定了垂直方向滚动距离 2.3 contenInset contentInset 是在不改变原有的contentSize基础上,让scrollView中的内容向四周多滚动一些。

    2.4K60发布于 2018-06-28
  • 来自专栏大数据学习笔记

    Mybatis读取Oracle数据库Blob字段,输出原文件

    public class AttachmentBean { private Integer id; private String finename; private Long contentSize finename) { this.finename= finename; } public Long getContentSize() { return contentSize ; } public void setContentSize(Long contentSize) { this.contentSize = contentSize; property="id"), @Result(column="FILENAME",property="filename"), @Result(column="CONTENTSIZE ",property="contentSize"), @Result(column="FILETYPE",property="fileType"), @Result

    1.4K20编辑于 2022-05-06
  • 来自专栏哈雷彗星撞地球

    iOS 中获取某个视图的截图

    CGFloat boundsWidth = boundsSize.width; CGFloat boundsHeight = boundsSize.height; // 2.获取contentSize CGSize contentSize = self.scrollView.contentSize; CGFloat contentHeight = contentSize.height setContentOffset:offset]; CGFloat scale = [UIScreen mainScreen].scale; CGSize imageSize = CGSizeMake(contentSize.width * scale, contentSize.height * scale); // 9.根据设备的分辨率重新绘制、拼接成完整清晰图片

    4K41发布于 2018-08-22
  • 来自专栏LinXunFeng的专栏

    iOS - Swift UICollectionView横向分页的问题UICollectionView横向分页的问题

    UICollectionView横向分页的问题 情况 直接看图 滚前 滚后 已经设置collectionView的isPagingEnabled为true了,可是出现了这种情况,原因就是collectionView的contentSize gestureRecognizers = <NSArray: 0x6180000557e0>; layer = <CALayer: 0x61000022a5a0>; contentOffset: {187.5, 0}; contentSize 不过对于现在来说太小题大做了,我选第二种方式~ 直接修改contentSize 我自定义了一个继承于UICollectionViewFlowLayout的Layout(LXFChatMoreCollectionLayout UICollectionView在创建的时候使用了它 在 LXFChatMoreCollectionLayout.swift 中我们需要重写父类的collectionViewContentSize,将contentSize

    1.9K30发布于 2018-06-29
  • 来自专栏学海无涯

    iOS开发之UIScrollView在Autolayout下的使用

    因为设置UIScrollView的布局约束是没有用的,UIScrollView的size(即contentSize)是根据其中的subviews所占据的size来计算的。 当然,如果contentSize的内容不足以布满整个UIScrollView时,滚动条将不会出现,UIScrollView也不会滚动。 即contentSize必须根据contentView的4条边来确定,而不是根据别的方式。这样,UIScrollView就把contentSize的4条边和contentView的4条边关联起来了。 如果contentView的4条边发生变化,UIScrollView会自动调整contentSize。 5、接下来就是在contentView上布局项目中需要的界面了。

    1.3K70发布于 2018-04-24
  • 来自专栏stringwu的互联网杂谈

    记一次 contentInsetAdjustmentBehavior 引发的bug

    来展示相关的文本内容,但内容的大小不确定,有可能会超过屏幕的大小,因此需要在外层嵌套一个UIScrollView来保证内容可以被完全展现给用户,在UILabel确定相关的高度后,再通过设置UIScrollView的contentSize 3.2 排查方向二 在发现不是初始y值的影响后,就猜测大概率是父View的影响,仔细查看了父View的设置代码后,发现其并没有设置顶部Top的距离,一行行代码排查后,怀疑是ContentSize的设置引起的 ,故注释掉了设置ContentSize的那一行设置: override func layoutSubviews() { super.layoutSubviews() ........... //设置scrollView的可滚动范围为 titleLabel的高度加上上面的距离30 //scrollView.contentSize = CGSize(width: 0, height : titleLabel.frame.height + 30) .............. } 注释掉这一行代码后,发现问题消失了,但由于没有设置scrollview的contentSize

    1.3K20编辑于 2022-08-12
  • 来自专栏渗透测试教程

    chromedp模拟浏览器基础入门

    chromedp.ActionFunc(func(ctx context.Context) error { // get layout metrics _, _, contentSize = nil { return err } width, height := int64(math.Ceil(contentSize.Width )), int64(math.Ceil(contentSize.Height)) // force viewport emulation err = emulation.SetDeviceMetricsOverride WithClip(&page.Viewport{ X: contentSize.X, Y: contentSize.Y , Width: contentSize.Width, Height: contentSize.Height,

    10.6K21发布于 2021-03-23
  • 来自专栏iOS开发攻城狮的集散地

    iOS WKWebView+UITableView混排

    tableView 加到 webView.scrollView 上, webView 加载的HTML最后留一个空白占位div,用于确定 tableView 的位置,在监听到webView.scrollView.contentSize 步骤1:确定webView和tableView的高度 //添加观察者 监听webView 和tableView 的contentSize - (void)addKVO{ [self.webView options:NSKeyValueObservingOptionNew context:nil]; [self.tableView addObserver:self forKeyPath:@"contentSize " options:NSKeyValueObservingOptionNew context:nil]; } /// 根据WebView和tableView的ContentSize变化,调整父scrollView.contentSize tableView的高度位置、展示区域 - (void)updateContainerScrollViewContentSize{ self.containerScrollView.contentSize

    2.3K30发布于 2020-06-09
  • 来自专栏陈满iOS

    iOS开发验证:取消UITableView的Footer自带的悬停效果

    sectionFooterHeight, 0); }else if (offsetY >= sectionHeaderHeight && offsetY <= tableview.contentSize.height UIEdgeInsetsMake(-sectionHeaderHeight, 0, -sectionFooterHeight, 0); }else if (offsetY >= tableview.contentSize.height - tableview.frame.size.height - sectionFooterHeight && offsetY <= tableview.contentSize.height - tableview.frame.size.height ) { tableview.contentInset = UIEdgeInsetsMake(-offsetY, 0, -(tableview.contentSize.height

    5.5K20发布于 2018-10-15
  • 来自专栏正则

    oc textview垂直居中

    id)object change:(NSDictionary *)change context:(void *)context { if ([keyPath isEqualToString:@"contentSize "])     { UITextView *tv = object; CGFloat deadSpace = ([tv bounds].size.height - [tv contentSize

    1.1K40发布于 2021-05-11
  • 来自专栏全栈程序员必看

    他们主动布局(autolayout)环境的图像编辑器

    二、实现细节 2.1基本思路 在实现上,这个页面能够分为两大块:一块是scrollview的设置:contentSize、 contentInset、zoomScale等等 和contentInset 的意义和作用: 图6.UIScrollView的contentSize和contentInset属性示意图 contentSize是你在scrollView 中要展示的内容(content)的大小,详细值要根 据content的尺寸而定,我们这里是要完整的无压缩的展示一个图片的内容,因此这里 在step 2中将contentSize设为图片(image.size 0),contentInset所标示的留白加上contentSize才是一个scrollView所能滑动的 所有区域。 必需要结合所载入图片的实际尺寸、圆形剪切框的位置 和大小信息来动态的调整scrollView的contentSize、contentInset和其他财产。

    1.2K10编辑于 2022-07-05
  • 来自专栏学海无涯

    iOS开发之有间距的UITableViewCell

    -sectionFooterHeight, 0); }else if (offsetY >= sectionHeaderHeight && offsetY <= tableview.contentSize.height UIEdgeInsetsMake(-sectionHeaderHeight, 0, -sectionFooterHeight, 0); }else if (offsetY >= tableview.contentSize.height - tableview.frame.size.height - sectionFooterHeight && offsetY <= tableview.contentSize.height - tableview.frame.size.height ) { tableview.contentInset = UIEdgeInsetsMake(-offsetY, 0, -(tableview.contentSize.height

    2.1K61发布于 2018-05-03
  • 来自专栏iOS逆向与安全

    iOS小技能:查看大图浏览器(图片支持滑动切换)

    [self changeSizeCenterY:0.0]; CGFloat offsetX = (scrollView.frame.size.width > scrollView.contentSize.width (scrollView.frame.size.width - scrollView.contentSize.width) * 0.5 : 0.0; CGFloat offsetY = ( scrollView.frame.size.height > scrollView.contentSize.height) ? (scrollView.frame.size.height - scrollView.contentSize.height) * 0.5 : 0.0; self.subImageView.center = CGPointMake(scrollView.contentSize.width * 0.5 + offsetX, scrollView.contentSize.height * 0.5 + offsetY

    1.6K30编辑于 2022-08-22
  • 来自专栏大宇笔记

    xib 创建scrollView 点击事件不可用问题

    不可点击原因:  由于scrollView的contentSize是根据我们自己加入的contentView算的。 如果我们手动往contentView添加子控件并自己改了contentSize,可以按照理想的滚动。但是contentView还是布局的那么长,子控件越出contentView边界自然不能点击。

    1.4K10发布于 2019-01-15
  • 来自专栏王大锤

    UIScrollView嵌套的完美解决方案

    syncScrollContext.innerOffset = contentOffset } } } } 第四步 两个ScrollView嵌套,并正确设置下层scrollView的contentSize 在下层BottomScrollView里面,添加topScrollView并设置contentSize。 下层scrollView的contentSize的高 = headerView.height + topScrollView.height。 流畅的滑动起来了 topScrollView.frame = CGRect(x: 0, y: offsetY, width: bounds.width, height: bounds.height) contentSize

    6.9K30发布于 2018-12-21
  • 来自专栏黑白天安全团队

    Antimalware Scan Interface Provider for Persistence

    myTriggerString3; RtlInitUnicodeString(&myTriggerString3, L"'Run my malware'"); ULONG actualSize; ULONGLONG contentSize SUCCEEDED(stream->GetAttribute(AMSI_ATTRIBUTE_CONTENT_SIZE, sizeof(ULONGLONG), reinterpret_cast<PBYTE>(&contentSize sizeof(PBYTE)) { *result = AMSI_RESULT_NOT_DETECTED; return S_OK; } if (contentAddress) { if (contentSize < 50) { UNICODE_STRING myuni; myuni.Buffer = (PWSTR)contentAddress; myuni.Length = (USHORT)contentSize ; myuni.MaximumLength = (USHORT)contentSize; if (RtlEqualUnicodeString(&myTriggerString1, &myuni, TRUE

    1.2K10发布于 2021-07-16
  • 来自专栏前端文章小tips

    IOS 滚动字幕

    获取到最大滚动范围就可以启动滚动事件 -(void)setScrMaxW:(NSInteger)scrMaxW{ _scrMaxW=scrMaxW; self.textScrollview.contentSize completion:nil]; //滚动到可滚动区域的一半时重置 if (self.textScrollview.contentOffset.x+1>=self.textScrollview.contentSize.width animated:NO]; } completion:nil]; ​ if (self.textScrollview.contentOffset.x>=self.textScrollview.contentSize.width-ViewAllWidth void)setScrollWidth:(CGFloat)scrollWidth{ _scrollWidth=scrollWidth; self.textScrollview.contentSize

    2.1K40发布于 2021-11-24
  • 来自专栏落影的专栏

    一个多UITableview的左右滑动简单解决方案

    UITableView添加到mContainerScrollView上,横坐标分别为0、self.view.width、self.view.width*2、self.view.width*3; 最后设置contentSize self.mContainerScrollView.contentSize = CGSizeMake(self.view.width * 4, 0); // 写0,关闭vertical的滚动 如果需要滚动到某一页 解决办法:contentSize的高度设置为0,关闭vertical的滚动。 contentSize = CGSizeMake(self.view.width * 4, 0); // 写0,关闭vertical的滚动 viewWithTag 具有传递性 代码中存在5个UIScrollView

    3.4K71发布于 2018-04-27
  • 来自专栏TechBox

    (转)iOS开发之UICollectionViewController系列(三) :UICollectionView自定义瀑布流

    - (void)prepareLayout; 2.内容滚动范围 下方是定义ContentSize的方法。该方法会返回CollectionView的大小,这个方法也是自定义布局中必须实现的方法。 说白了,就是设置ScrollView的ContentSize,即滚动区域。 initData]; [self initCellWidth]; [self initCellHeight]; } 2.返回内容的范围,即为CollectionView设定ContentSize ContentSize的Width就是屏幕的宽度,而ContentSize的高度是一列中最后一个Cell的Y坐标加上其自身高度的最大值。在此函数中会调用求CellY数组中的最大值。 具体实现代码如下: Objective-C /** * 该方法返回CollectionView的ContentSize的大小 */ - (CGSize)collectionViewContentSize

    6.4K40发布于 2018-06-05
  • 来自专栏青玉伏案

    iOS开发之窥探UICollectionViewController(三) --使用UICollectionView自定义瀑布流

    . 3 // Subclasses should always call super if they override. 4 - (void)prepareLayout; 2.内容滚动范围 下方是定义ContentSize 说白了,就是设置ScrollView的ContentSize,即滚动区域。 self initCellWidth]; 12 13 [self initCellHeight]; 14 15 } 2.返回内容的范围,即为CollectionView设定ContentSize ContentSize的Width就是屏幕的宽度,而ContentSize的高度是一列中最后一个Cell的Y坐标加上其自身高度的最大值。在此函数中会调用求CellY数组中的最大值。 具体实现代码如下: 1 /** 2 * 该方法返回CollectionView的ContentSize的大小 3 */ 4 - (CGSize)collectionViewContentSize{

    1.7K100发布于 2018-01-11
领券