开发者

What should we do when we want to have a view bigger than Phone?

The way Yelp seems doing it is that it uses UITableView

Hence, a lot of content can be put and users just scroll up and down.

Can I do that without UITableView?

What about if I want to use UIView instead?

-

I sort of figure out that UIScrollView is the way to do it. However for that to work we need to set up contentSize.

Why SDK doesn't just use UIScrollView width and height in specifying that contentSize?

Also how to get UIScrollView width and height.

For example, I set the height of my UIScrollView to 1000

However doing scrollView.contentSize = CGSizeMake(scrollView.bounds.size.width, scrollView.bounds.size.height); NSLog(@开发者_运维百科"Content Size: %f" , scrollView.bounds.size.height); NSLog(@"Content Size: %f" , scrollView.frame.size.height);

All produce 416 even though I set the height of the UIScrollView to be 1000


You can probably create a UIView with a big frame and gesture recognizers to make it work but there is no point redoing what's been done. UITableView is a subclass of UIScrollView. Scroll views are meant to present a canvas that is bigger than the viewport i.e. the user's screen. There is a good bit of customizations that you can do with them. So use UIScrollView to present that view.


This is exactly what UIScrollView is designed for. Don't reinvent the wheel.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜