zoukankan      html  css  js  c++  java
  • scrollview不能滚动

    1. 图片视图上不能直接滚动,需要设置交互属性为YES

    _contentView = [[UIImageView alloc]initWithFrame:CGRectMake(0, _headerView.bottom, kDeviceWidth, kDeviceHeight-20-44-49-_headerView.height-kFooterViewHeight)];

    _contentView.backgroundColor = [UIColor cyanColor]; _contentView.userInteractionEnabled = YES; [self addSubview:_contentView]; 


    2.contentSize 这个属性,比uiscrollview的frame要小, 无需滚动, 自然就滚动不了。 

    3.scrollenabled 这个属性,标识着是否允许滚动,要言设成yes

    4.因为AutoLayout的影响 -(void)viewDidLayoutSubviews { self.scrollView.contentSize = CGSizeMake(712,1000); }

    另外还有一些比较隐蔽的原因. 如果这个scrollView是在IB里面生成的话,还得手动设置它的contentSize,并且不能在initWithNibName:bundle:里面设置,因为The nib file you specify is not loaded right away. It is loaded the first time the view controller’s view is accessed. If you want to perform additional initialization after the nib file is loaded, override theviewDidLoad method and perform your tasks there.

  • 相关阅读:
    Simple Form Fading
    CResizableFormView
    User-Defined Multi-Lingual Applications
    Automatic Resizing of a FormView Based Application When the User Toggles the Control Bars On or Off
    Save Zip File in Access Database With File Encryption in C#
    continue
    break
    declare/typeset
    bg/fg/jobs
    .
  • 原文地址:https://www.cnblogs.com/Bo-tree/p/5144929.html
Copyright © 2011-2022 走看看