모든 이미지를 배열에로드 할 수 있습니다. 그리고 당신은 하나의 이미지보기, 텍스트 필드를 갖는 뷰를 디자인하고 아래 코드를 시도 할 수 있습니다 :
배열 이름 : examplearray 및보기 이름 : exampleview 위의 코드는 이미지와 텍스트를 표시하는 것입니다
-(void)updateImagesInScrollView
{
int cnt = [examplearray count];
for(int j=0; j< cnt; ++j)
{
NSArray *nibContents = [[NSBundle mainBundle] loadNibNamed:@"exampleview"
owner:self
options:nil];
UIView *myView = [nibContents objectAtIndex:0];
exampleview * rview= (exampleview *)myView;
/* you can get your image from the array and set the image*/
rview.imageview.image = yourimage;
/*adding the view to your scrollview*/
[self.ScrollView addSubview:rview];
}
/* you need to set the content size of the scroll view */
self.ScrollView.contentSize = CGSizeMake(X, self.mHorizontalScrollView.contentSize.height);
}
필드를 가로 스크롤보기에 표시합니다. 해당보기에 사용자 지정 단추가 있고 단추 동작에서 세부 화면을 가져 오기위한 코드를 작성할 수 있습니다.