开发者

How to make a horizontal swiping screen with page control support

I am struggling...REALLY struggling with UIScrollView and UIPAgeControl. I have You Tubed and searched everywhere but i just can't seem to pull all the pieces of knowledge into something that meets my need.

I have an app that at the moment has 2 view controllers classes. Lets call them "mission" and "weather". So we have mission.h, mission.m, mission.xib and weather.h, weather.m and weather.xib.The simply display values read from an XML file. The xib dimensions are 311x420.

The problem is when I am on the mission screen I want to be able to swipe left and have the weather screen appear and vice versa.

I know this can be done with UIScrollView but I am having trouble understanding exactly how the pieces hold together. And then on top of that, how does UIPageControl work with UI开发者_JS百科ScrollView to show the "dots" down the bottom when the user swipes between screens?

Can anyone help? How can I make it that when the mission.xib is loaded I can swipe to Weather.xib?

I feel embarrassed asking this as I'm sure someone will say it is straightforward but after days of trying to crack this nut I though I would ask.


Create a scroll view in your main view controller. Add the views weather and mission to the scrollview. Set the frame for both these views. Then you will be able to scroll from weather to mission and vice versa.

Why do you think this is complex?

For pagecontrol, you can hook it as a outlet to mainviewcontroller and keep updating it accordingly.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜