开发者

iPhone view within a view [closed]

开发者 https://www.devze.com 2023-03-29 09:49 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago.

Hi I want to create an applicatio开发者_运维百科n with a similar home screen to Photovine.

It seems to have the parent view, but within the parent view it has a sort of subview which you can scroll through, Just wondering how this is done.


I don't know the Photovine, but what you are searching for might be UIScrollView. You can always add a subview to another view. If you want subview to be scrollable, you can use UIScrollView or one of its implementation (UITableView etc.)

Programatically you would do this as follows:

UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 300, 300)];
scrollView.contentSize = CGSizeMake(1000, 1000);

[mainView addSubview:scrollView]; 

Here I created UIScrollView of size 300x300 with content of size 1000x1000. You must define content size. If you want UIScrollView to be scrollable, content size must exceed UIScrollView's.

EDIT: To lock scrolling to page, you can use

scrollView.pagingEnabled = YES;
0

精彩评论

暂无评论...
验证码 换一张
取 消