0

Ive got a UIView as a sub-view of UIScrollView, but cant fathom out how to reference to each different view to set its settings. For example I know I need to set the UIViews content size bigger than the UIScrollViews so scrolling can occur, but dont know where to put the code to set these values (can I do it in the main view controllers .m file? if so what is the syntax for referencing to these different views? do I have to give each view its own custom class to be able to do this?). Any help would be very much appreciated!

4

1 に答える 1

1

classごとにカスタムを作成する必要はありません。のUIViewsビューごとにタグ プロパティを設定します。その別のビューで何らかの変更を行う必要がある場合は、スクロールビューから取得します。UIScrollViewsubView

UIView *innerView  = [yourScrollView viewWithTag:yourViewTag];

これで、このビューに何かを追加したり削除したりできるようになりましたscrollview

于 2013-06-06T20:43:19.917 に答える