0

Suppose that I have an object named Topic. And inside that topic I can create Messages. The most recent messages needs to be the first message on the list (This is already done). My problem is that I need to show the messages in a view that can be scrolled either right or left (Right to show the older messages, and left to go back to the newer messages). Imagine an image collection that can be scrolled sideways in a ScrollView, that how this should look like. Since the messages is being add by the user, I can't use UIImage.

Any opinions how I should deal with this? or do you know any tutorial links that can help me? Thanks.

caribbean
  • 748
  • 1
  • 9
  • 29
  • Are u looking for sidebar similar to facebook app, where you can slide in both way? – HRM Jul 05 '13 at 09:15
  • You can create custom UIViewController (MessageVC) for message. If you scroll then create second MessageVC and change both view controller's frame with animation. – stosha Jul 05 '13 at 09:24
  • I have my `UIViewController` for message. This View Controller has also a scroll view, and in the scroll view I want to load the messages . Since the User can add messages, the number of pages that can be loaded is not fixed. – caribbean Jul 05 '13 at 09:28
  • you can create a parent view controller which will make scroll. On parent view we place two view controllers's view. – stosha Jul 05 '13 at 09:32
  • Then checkout this http://stackoverflow.com/questions/7989020/whats-the-best-way-to-develop-a-sideswipe-menu-like-the-one-in-facebooks-new-i and choose a best one to meet your reqs. – HRM Jul 05 '13 at 09:44
  • please check out this link..http://stackoverflow.com/questions/17521176/how-to-make-the-uiview-function-like-uiscrollview-objective-c. In this, I made another question for the same problem. – caribbean Jul 08 '13 at 07:31

2 Answers2

1

I have found Apple's Street Scroller demo application a good source of inspiration for doing something similar to what you propose. Although the demo seems to stress the "infinite scrolling" aspect, it also demonstrates how one can achieve a smoothly scrolling view that is populated with small detail views - in your case those small detail views would be used to show details about a message.

<self-advertisement>The demo is fairly basic, it is far away from some piece of library code that can be just dropped into an app and will work out-of-the-box. In my own app I have made an attempt at generalizing the concept and writing a reusable class that provides seamless (i.e. not paginated) scrolling through a finite number of item views. In case you are interested, have a look at the ItemScrollView class in this GitHub repo. As always, YMMV.</self-advertisement>

herzbube
  • 13,158
  • 9
  • 45
  • 87
  • thanks for this but I think i should make a different approach to the problem. Check out my new question.. please check out this link..http://stackoverflow.com/questions/17521176/how-to-make-the-uiview-function-like-uiscrollview-objective-c Thanks – caribbean Jul 08 '13 at 07:33
0

Maybe you can use this scrollview just create a cell containing a label which will hold the message and pass the array of message just like you use an array for populating tableview cell. This scrollview will also take care of reusing your views. :) so no need to worry about memory.

Just implement below datasource methods

-(VSScrollViewCell *)vsscrollView:(VSScrollView *)scrollView viewAtPosition:(int)position;
// implement this to tell VSScrollview the view at position "position" . This view is VSScrollviewCell or subclass of VSScrollviewCell.

-(NSUInteger)numberOfViewInvsscrollview:(VSScrollView *)scrollview;

// implement this to tell VSScrollview about number of views you want in VSSCrollview.

by default, height and width of cell will be bounds of scrollview and spacing between cell will be 0, which you can customize using other datasource methods listed in readme.

Vishal Singh
  • 4,400
  • 4
  • 27
  • 43
  • thanks for this but I think i should make a different approach to the problem. Check out my new question.. please check out this link..http://stackoverflow.com/questions/17521176/how-to-make-the-uiview-function-like-uiscrollview-objective-c Thanks – caribbean Jul 08 '13 at 07:34