开发者

How to split an UIView

Ok, let's say we have an UIView (let's call it mainV开发者_开发百科iew) with the size of 480*320 (landscape), and I want to create 2 other views, one to display the first half of the mainView and the second will display the second half of the mainView and both of them will be 240*320, how can I do this?


It all depends on what is in the view at the first place. If you have dynamic content like changing pictures you can just create two images from that with no problem but if you have UIButtons and other subviews then it's a lot of trouble. For instance what to do if a button or any other object lies in the middle of the main view. If you know your object will be position in either of two half's of the main view then you would go about splitting like this. Check all the subviews of the main view, depending on their position assign them to your new left or right view. The tricky part will be with the right view b/c you will have to adjust the x coordinate.


use the code and split it and replace the name by using the field name which present in the IB ..use picker view method

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜