开发者

How to do Ipad pagination

My project is a news application, the news are came from the url by using xml parsi开发者_运维技巧ng, my problem is news content are big which cannot display in a single page, I want to display the content in multiple pages according to the size of the content dynamically. The user can navigate by paging and see the rest of the content. I want to do it in ipad.


What you need to do is divide your string or data into parts as per your requirement.

Go through the documentation of NSString to divide it. .

If you are successful in doing so than you will get the no. of pages that is required to show in the scroll view.

You can set the contentSize of scrollview like this.

scrollView.contentSize = CGSize(scrollView.frame.width * noOfPages, scrollView.frame.height);

Then just enable paging for scrollview.

Also if you are using pageControl to show the no. of pages then you just need to set the number of pages for the same and everything will be taken care off.


Use the UIScrollView class to hold the content and turn on its pagingEnabled property to simulate pagination.

You can see the docs for UIScrollView

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜