【问题标题】:iOS UIScrollView bounces back to the topiOS UIScrollView 弹回顶部
【发布时间】:2013-01-25 19:35:38
【问题描述】:

当我使用 UIScrollView 向下滚动并放手时,它不会停留在我向下滚动的位置,它会弹回顶部

http://www.joules.name/ScreenShot2013-01-25at19.11.45.png

http://joules.name/ScreenShot2013-01-25at19.04.12.png

在 ViewController.h 中

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController


{
    IBOutlet UIScrollView *scoller;

}

@end

在 ViewController.m 中

#import "ViewController.h"

@interface ViewController ()


@end

@implementation ViewController

- (void)viewDidAppear
{
    [scoller setScrollEnabled:YES];
    [scoller setContentSize:CGSizeMake(320, 1000)];
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.


}

@end

【问题讨论】:

  • 有趣。我在 Xcode 4.5.2 中看不到内容拥抱和压缩属性。
  • 笔尖的scrollview高度怎么是800..你在iPad上吗?

标签: ios uiscrollview xcode4.5


【解决方案1】:

这可能是因为您在 nib 文件中将滚动视图的实际高度设置为 800。更改它以适应屏幕。

【讨论】:

  • 这是 iphone 我已经将 UIscrollview 对象的高度更改为 504 大小仍然不起作用(我认为您必须使 UIscrollview 对象的大小与内容相同,并确保 scoller setContentSize :CGSizeMake(320, 1000)]; 等于或大于 UIscrollview)
猜你喜欢
  • 2023-04-07
  • 1970-01-01
  • 2019-03-24
  • 2020-05-14
  • 2017-11-19
  • 2011-11-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多