Reputation: 307
I am making an application in which I am implementing event like as: In bottom of view a scroll view which is scrolling in horizontal direction. In scroll view I have added some text field and images. It looks like as news channels show breaking news in bottom of screen and update it and when click then show detail screen. I want also do in application so that how can I do that?
What I will do so that I will also get this type of feature in application? How use scroll view so that I will show some text in view and when click on that then get detail view?
Upvotes: 2
Views: 353
Reputation: 637
You can load all the images to an array. And you can design a view having one image view, some text fields and try the below code:
array name: examplearray and view name :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);
}
The above code is to display the image and text fields in the horizontal scroll view. I suggest you to have a custom button on that view and in that button action you can write code to get detail Screen.
Upvotes: 1