【发布时间】:2010-10-28 00:41:32
【问题描述】:
UIViewController viewDidLoad中UITableView设置contentOffset不生效...
- (void)viewDidLoad
{
[super viewDidLoad];
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
self.tableView.contentOffset = CGPointMake(0.0f, 200.0f);
}
...该值已设置,但是,在表视图的 contentOffset 上设置观察者后,我可以看到它在 viewDidLoad 运行后至少再次设置为零(这是在一个空的 iphone“表视图" 模板项目,以确保它不是我在其他地方做的事情)。
我会使用 viewWillAppear: 但如果用户从其他地方返回到控制器,这会导致用户滚动的位置丢失。
有什么想法吗?我相信这一定很简单:)
【问题讨论】:
标签: iphone cocoa cocoa-touch uikit