CGRect wholeWindow = CGRectMake(0.0, 0.0, self.view.frame.size.width, self.view.frame.size.height); UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:wholeWindow]; [self.view addSubview:scrollView]; [scrollView release]; CGRect reallyBigRect; reallyBigRect.origin = CGPointZero; reallyBigRect.size.width = wholeWindow.size.width * 1.2; reallyBigRect.size.height = wholeWindow.size.height * 2.0; [scrollView setContentSize:reallyBigRect.size]; CGPoint offset; offset.x = 0.0; offset.y = 0.0; [scrollView setContentOffset:offset]; [scrollView setMinimumZoomScale:0.5]; [scrollView setMaximumZoomScale:5]; [scrollView setDelegate:self]; summaryView = [[ProjectSummaryView alloc] initWithFrame:reallyBigRect]; [summaryView setBackgroundColor:[UIColor clearColor]]; [scrollView addSubview:summaryView];
本文介绍如何使用 Objective-C 创建一个可以缩放的 UIScrollView,并设置其内容大小超过视图区域,实现平移和缩放功能。
865

被折叠的 条评论
为什么被折叠?



