我想兩個UIScrollView
添加的爲一個UIView
,無論是scrollView
的顯示正常,是我遇到的問題是,如何確定哪些scrollView
滾動,因爲根據我有填充圖像。這是我在做什麼:兩個UIScrollView中的一個的UIView
我有一個ViewController
與UIScrollViewDelegate
。
在我ViewConroller
的loadView
方法,我做了以下內容:
CGRect scrollViewFrame1;
CGPoint scrollViewPoint1;
scrollViewPoint1.x = 0;
scrollViewPoint1.y = 57;
CGSize scrollViewSize1;
scrollViewSize1.width = 320;
scrollViewSize1.height = 154;
scrollViewFrame1.size = scrollViewSize1;
scrollViewFrame1.origin = scrollViewPoint1;
CGRect scrollViewFrame2;
CGPoint scrollViewPoint2;
scrollViewPoint2.x = 0;
scrollViewPoint2.y = 258;
CGSize scrollViewSize2;
scrollViewSize2.width = 320;
scrollViewSize2.height = 154;
scrollViewFrame2.size = scrollViewSize2;
scrollViewFrame2.origin = scrollViewPoint2;
scrollView1 = [[UIScrollView alloc] initWithFrame:scrollViewFrame1];
scrollView2 = [[UIScrollView alloc] initWithFrame:scrollViewFrame2];
然後:
scrollView1.delegate = self;
scrollView2.delegate = self;
然後:
[self.view addSubView:scrollView1];
[self.view addSubView:scrollView2];
我有一個scrollViewDidScroll:
方法,我該如何確定這個方法去哪個t所調用,因爲基於此,我需要爲我的scrollView
填充不同的圖像。
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
//Code to populate the next or previous images for scrollView
// If it was one i am able to show the images
}
感謝您的幫助。
感謝大衛快速回復。是的,這工作 – Yogesh 2011-03-17 16:01:35
非常感謝這一點。 – shaikh 2012-12-25 12:48:44