PDA

View Full Version : making UIView scrollable




sujithkrishnan
Jul 3, 2008, 04:18 AM
Hi all.


I am having a drill-down menu with UITableViewController end menu is a UIViewController...

In the last menu (UIViewController objet)..
I do


[self.view addSubView:myFirstLabel];
[self.view addSubView:mySmallImageView];
[self.view addSubView:mySecondLabel];
[self.view addSubView:myTextView];


All these are going outside the screen bounds.... (however i can make them congested to fit in screen, but i dont prefer..)

Problem is that the self.view is not scrollable..
I want to make it scrollable so that i can scroll to see all the labels..
(however the textview is scrollable by itself)

By giving self.view's bounds greater that screen bounds is not making it scrollable...



robbieduncan
Jul 3, 2008, 05:15 AM
I've not done any iPhone work so this may be well off, but in standard Cocoa you can't make a view scrollable on it's own: you have to use a scroll view to contain the view. They may have simplified this on the iPhone though. I do see reference to UIScrollView in places so I'd look at that...

louden
Jul 13, 2008, 08:34 AM
Instead of building a bunch of labels, use a Table View and create groups and cells on the table programatially... The more cells you create - instant scrolling!

Take a look at the samples...

louden
Jul 13, 2008, 11:13 PM
... and make sure you read the documentation on how to work with Tables and Cells - you need to make sure you implement the delegates they require to manage memory properly...

sujithkrishnan
Jul 14, 2008, 12:24 AM
... and make sure you read the documentation on how to work with Tables and Cells - you need to make sure you implement the delegates they require to manage memory properly...

Thanks...

But how to accomodate textfields in tableviews ????
We can change labels with cell.text, but for textfields??
Also I face some problem with UIViewController - say its not aligning themselves to the bounds on rotating device... However the UITableviews are adjusting by themsleves..

I wll follow the docs too for more info...by that time can u answer the above?

louden
Jul 14, 2008, 03:42 PM
Thanks...

But how to accomodate textfields in tableviews ????
We can change labels with cell.text, but for textfields??
Also I face some problem with UIViewController - say its not aligning themselves to the bounds on rotating device... However the UITableviews are adjusting by themsleves..

I wll follow the docs too for more info...by that time can u answer the above?


You don't! Table cells can be edited...

Look at: tableView:shouldEditTableColumn:row

And check out the guide in the docs about Table View Programming... Check out some of the samples that use these delegates. Most of the basic code is all boilerplate. Just cut and paste from the examples, and it works!

(your mileage may vary)

louden
Jul 30, 2008, 11:52 AM
I'm looking at this right now... You could have done this by adding a UIScrollView and supporting the UIScrollViewDelegate.

I'm trying to figure out how to use the UIPageView control to allow horizontal scrolling between views, but then have vertical scrolling available in a subview on a single page of the page view.

I can't get the scrolling notification to move down to the view. Is there a way to do that?