Horizontal and vertical scrolling in a UITableview [closed] - iphone

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I want to make a lineup for a festival. You can see what I want to achieve below here.
You can scroll in every direction ,horizontal - vertical and from left to right corner (don't know the proper word in english).If you scroll in one section ever other section should scroll with it.
My question is know how can you achieve this? I'm searching for days to get this working but don't find a good solution...

The row in the UITableView doesn't scrolls itself inside the UITableView. one solution Is to use an UIScrollView and then inside add the UITableView. This UIScrollView will have the same size that your UITableView have now, but the UIScrollView contentSize property will have the same height but it would have a greater width.
UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectMake(x, x, x, x) style:...]
[scrollView addSubview:tableView];
// Set the size of your table to be the size of it's contents
// (since the outer scroll view will handle the scrolling).
CGRect tableFrame = tableView.frame;
tableFrame.size.height = tableView.contentSize.height;
tableFrame.size.width = tableView.contentSize.width; // if you would allow horiz scrolling
tableView.frame = tableFrame;
// Set the content size of your scroll view to be the content size of your
// table view + whatever else you have in the scroll view.
// For the purposes of this example, I'm assuming the table view is in there alone.
scrollView.contentSize = tableView.contentSize;

For better understanding with UITableView scrolling you can follow this two links
horizontally table scrolling
vertically table scrolling
i hope it helps you for better understanding and make familiar with UITableViewDelegate. Thanks

Related

apply zoom on sequence image animation and imageview subview of scroll view ios [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I have an app which displays a sequence of images.
I want to apply zoom in and zoom out on current image.
The zoom in will be done by pinch effect and zoom out will be done by button click.
What do I have to do?
First You have to set the view which you want to zoom in UIScrollView. In your case it must be UIImageView
use the method of UIScrollView
- (UIView *) viewForZoomingInScrollView: (UIScrollView *) scrollView
{
return _imageView;
}
then you can call the delegate method of UIScrollView
- (void) scrollViewDidZoom: (UIScrollView *) scrollView
{
// add ur code here to center ur image position after zooming
}
also set properties of UIScrollView
minimumZoomScale = 1.0
maximumZoomScale = // ACCORDING TO YOU
And if you want to Zoom Out on button click, then set zoomScale = 1.0 of UIScrollView on IBAction of button

How to find dynamic centre of iOS device screen [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
iOS SDK: Moving the button into the center of screen by code
UIImageView. Zoom and Center to arbitrary rectangle. Can’t determine correct center on screen
I'm trying to centralise an UIActivityIndicator in a UIWebView(which in turn is a subView of a UIScrollView, which also has a UIToolbar element to the left - although the left-toolbar isn't always visible)
Similar questions have been asked before, but the point is in finding the center "dynamically" i.e. on change of orientation as well as presence or absence of the left toolbar.
What's the best approach? Is there any better way to do this than overriding the method shouldAutorotateToInterfaceOrientation?
Center of what btw?
You can access the UIViewController's center as self.view.center
or in your case, UIWebView's center as yourwebView.center
And by giving it resizing elements of top left, activityindicator would center it-selves always.
EDIT :
If you want center of the screen that would be gained by frame like
Consider activity indicator of width and height 30, 30.
(([UIScreen mainScreen].bounds.size.width)/2 - 15, ([UIScreen mainScreen].bounds.size.height)/2 - 15, 30, 30);
Then, set autoresizing elements to none.
Go to size Inspector and remove all the arrows from the Auto-sizing feature.
There can be not general solution to your question. This is because only you know what element in your view you want to ignore or not. The view always stays the same, no matter what element you add to it. So, I suggest getting a rectangle for the part of the view you consider as clear/empty/available and setting your loading indicator in that. Just get the view's whole frame (self.view.frame.size.height) and substract any elements from there. For example
MyIndicator *indicator = [[MyIndicator alloc] initWithFrame:CGRectMake(self.toolbar.frame.size.width + self.toolbar.frame.origin.x, self.topBar.frame.size.height + self.topBar.frame.origin.y, self.view.frame.size.width - self.toolbar.frame.size.width - self.toolbar.frame.origin.x, self.view.frame.size.height - self.topBar.frame.size.height - self.topBar.frame.origin.y)];

How to diable horizontal scrolling of uitable view? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Disable UITableView horizontal scroll
Please can any one tell me how to disable horizontal scrolling of tableview..
Kindly help..
If your tablecontentview width is same as your view width it will not scroll in horizontal way but if you want that your tableview should not bounce then you can disable bouncing of your tableview as
m_TableView.bounces = NO;

Adding buttons dynamically to a UIScrollView which changes to fit the number of buttons using Objective-C

I have an array which loads in a database depending on what button the user chooses. How can I add these buttons to a scroll view which is only as large as it needs to be to hold all the buttons? I know I can declare the size of the scroll view, but I don't want it to be too large so that it can fit a large number of buttons then have lots of empty space if a smaller array is used to create less buttons. Is there an easy way to do this?
I assume you can figure out the vertical height required to display the number of buttons to be displayed before adding them to the scrollview.
If so, at the time of adding a fresh set of buttons, or 'refreshing' the scrollview, I guess you can simply set the correct contentSize of the scrollview.
Check the UIScrollView reference for #property(nonatomic) CGSize contentSize
You can do it in two ways .
Either you can change the frame of the scrollview dynamically
myScrollView.frame = CGRectMake(x, y, newWidth, newHeight);
or you can change the contentSize of the scrollView dynamically keeping the frame constant.
myScrollView.contentSize = CGSizeMake(newWidth, newHeight);

Mimic behaviour of UITableView section headers staying visible during scroll

When you have a sectioned, plain-style tableview on the iPhone, such as in the Contacts app, the section headers remain visible when you scroll past them until they are pushed offscreen by the next section header.
Does anyone know how to achieve something like this in an ordinary scrollview? I already have one scrollview nested in another to get horizontal paging with vertical smooth-scrolling, so I'm reluctant to add a third scrollview.
Cheers
Basically I did a bunch of maths in scrollViewDidScroll: and set the frame of the subview.
Edit:
Well my exact requirements were a bit different than the question I asked, I have a footer view as opposed to a header view. Basically in scrollViewDidScroll I have:
CGRect frame = self.footerView.frame;
frame.origin.y = MIN(self.bounds.size.height -
self.footerView.frame.size.height +
self.contentOffset.y,
self.contentSize.height);
self.footerView.frame = frame;
This ensures the footer view, which is a subview of the scroll view, is always visible at the bottom of the scroll view, and there is never a gap between the footer view and the bottom of the content view.