UIScrollView帮助

发布于 2024-10-30 18:15:49 字数 124 浏览 1 评论 0原文

有没有办法将多个 UIView 放入标签栏页面的 UIScrollView 中。如果是这样,我该怎么做?为了简单起见,想象一下跳板上的主屏幕图标。每个页面都是一个 UIView。我基本上想把它放在标签栏页面上。这可能吗?我该怎么做呢?

Is there a way to put several UIViews In a UIScrollView in a tabbar page. If so, how would I do that? To make it simple, Imageine the homescreen icons on the springboard. Each page is a UIView. I want to basically put this on a tabbar page. Is this possible? How would I do it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蓝戈者 2024-11-06 18:15:49

笔记:
首先尝试接受答案,然后只有您会从我们的前辈那里得到很多好的答案......

首先创建 uiscrollview ,然后将其添加到选项卡栏......用于创建 uiscrollview

UIScrollView *scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width,self.view.frame.size.height)];  
scroll.pagingEnabled = YES;  
NSInteger numberOfViews = 3;  
for (int i = 0; i < numberOfViews; i++) {  
CGFloat yOrigin = i * self.view.frame.size.width;  
UIView *awesomeView = [[UIView alloc] initWithFrame:CGRectMake(yOrigin, 0, self.view.frame.size.width,   self.view.frame.size.height)];  
awesomeView.backgroundColor = [UIColor colorWithRed:0.5/i green:0.5 blue:0.5 alpha:1];  
[scroll addSubview:awesomeView];  
[awesomeView release];   
}     
scroll.contentSize = CGSizeMake(self.view.frame.size.width * numberOfViews, self.view.frame.size.height);
[self.view addSubview:scroll];  

NOTE:
First try to accept the answers then only you will get lot of good answer from our seniors.....

first create the uiscrollview and then add that it to the tabbar... for creating the uiscrollview

UIScrollView *scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width,self.view.frame.size.height)];  
scroll.pagingEnabled = YES;  
NSInteger numberOfViews = 3;  
for (int i = 0; i < numberOfViews; i++) {  
CGFloat yOrigin = i * self.view.frame.size.width;  
UIView *awesomeView = [[UIView alloc] initWithFrame:CGRectMake(yOrigin, 0, self.view.frame.size.width,   self.view.frame.size.height)];  
awesomeView.backgroundColor = [UIColor colorWithRed:0.5/i green:0.5 blue:0.5 alpha:1];  
[scroll addSubview:awesomeView];  
[awesomeView release];   
}     
scroll.contentSize = CGSizeMake(self.view.frame.size.width * numberOfViews, self.view.frame.size.height);
[self.view addSubview:scroll];  
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文