ios - Overlapping table views and scrolling - iphone

I am writing a simple iphone app. I have:
- A search bar at the top
- A table view below that
I've got another table view which gets displayed under the search bar once the user starts typing, showing suggestions for what they might mean. When shown this table view overlaps with the main table view mentioned above.
The problem I have is that I cant scroll the table view showing suggestions. When I try to it scrolls the table view it's overlapping instead.
Any thoughts on how to make the suggestions table view scroll? I could be doing something silly - I'm very new to iphone programming.
Thanks!

The problem seems to be that I was adding the table view holding the suggestions to the search bar, adding it to the search bar's parent seems to have fixed it. I.e:
[[searchBar superview] addSubview:tableView];
I assume the logic is that I can only receive touch events that overlap with my views parent area.

Related

Cannot get scroll view to scroll with multiple table views in the document view

I am trying this using a Document-Based application. I'm new to programming, so if I need to use a view-based let me know. I am trying to create a data entry screen that has one table view as the master, and many more table views as the Details. I am using interface Builder. I have embedded all views (master and detail) in a scroll view. I've also tried embedding all the details views into a box, and embedding that box into a scroll view. I cannot get any of the tries to scroll. It "bounces" when I try to scroll and I can see the other table views for a second, but it won't scroll. I have tried adding constraints and having IB add the constraints. No combination of constraints or no constraints seems to work. I have also tried changing the size of the Custom View that holds all the other views and that doesn't work either. I know I'm missing something simple. If you need more information, let me know. Thanks for all suggestions.
EDIT to add more detail.
I am using Master-Details for this part of the project. The goal is to be able to scroll vertically up and down to access all of the nine table views that are part of the Details for the Master Airport Table View.
All of the table views I have work correctly, scrolling as expected inside of the table views. The trouble occurs with the Details Bordered Scroll View that contains all the text labels, buttons and individual table views. That Details Bordered Scroll View will not scroll. In the view hierarchy below it is Bordered Scroll View - Box.
You can see in the view hierarchy I have a Master Table View called Airport Bordered Scroll View - Table View, with the associated labels and buttons separate from the Details table views.
I embedded all the table views, labels and buttons that are part of the Details section of the Master-Details in a Box named Details Box. Then I tried embedding the Details Box in a Scroll View so I can access every Details Table View, but that didn’t work. In another build, I tried embedding the Details Table Views and associated buttons and labels into their own scroll view, without the box. Again, that wouldn’t scroll either.
I'm too new on this site for uploading screen shots, so I think it gives a link to see it.
View Hierarchy:
This is the view hierarchy when I tried using a box around the Details views.
View hierarchy
This is what I have built using interface builder. Again, all of the table views perform normally.
Interface Builder
Here is the running app. You can see that the last table View, HUD Data, is not shown in the screen and I cannot scroll down to see it.
Window after running
The code I have added in Document.swift is mainly for undo and archiving so I don't think it would help here (I could be very wrong though, let me know if so).
I have created separate types for each of the tableViews. Again, the only code in them so far are the properties and NSCoding protocols.
I can definitely post these if you need to see them.
I used interface builder for every view, label and button so there is no code for them.

Table View Not scrolling to the last row?

I am making an iPhone App.
I have used table view in some View Controller.
In iPhone it is scrolling Ok.
I have converted the app to the iPad and autoresized the table view via IB and changed the size of CELL.
It is not showing me the last cell and giving me a jerky feel so I could not select it.
I don not know where I am going wrong?
Actually It is a problem of resizing autoresizing.
In my case
Table view is showing the correct result now.
You can see below tabe view I have used Image view, so by autoresizing property (IB) some part of the table hides below the Imageview because of extra stretching.
Otherwise table view is working perfectly well.s

UIScrollView always bounce upwards and does not show scroll bar in iphone

This is probably simple but I do not seem to get it to work. I have a view and inside it I have a scroll view and inside it I have a view with some labels and a button. the height of the text inside the labels changes according to some condition so I need to scroll down to see it. But whenever I try to scroll down it bounce back up without giving me a chance to view the rest of the view.
Basically, I want when I scroll down, the view to remain down as it normally should. Besides I do not see the scroll bar at all when I'm scrolling.
I know I probably do not understand how scroll views work, so I'd appreciate any help to explain to me the behavior of scroll views.
P.S. I built my whole view in a nib file and this specific setup That I mentioned at the beginning is based on a suggestion from one question I read here.
Thanks, Mohsen
you need to set content size of your scroll view
[scrollView setContentSize:CGSizeMake(360,1000)];
you can make the content size dynamic as per your calculation.

UITableView covering up other elements?

I'm writing my first iphone app and through several examples I've got a UITableView which is displaying some records from an sqlite db. I placed the element through IB and then had to set it's height inside of my view controller, in the viewDidLoad method:
self.tableView.frame = CGRectMake(0,150,320,300);
While the positioning appears to be working properly, a text field, button and label I originally had on the page are now being covered by a white area. Am I not positioning this table properly?
They're all within the same view - do I need to use multiple views?
Here is what the running app looks like: http://tinypic.com/r/2n7qj35/5
Here is what the IB view looks like: (before the table was ever added, the text/button stuff showed up just fine): http://tinypic.com/r/1491kw4/5
You'll need to resize the tableView or move the other objects ( a text field, button and label ) around to accommodate the tableView.

UITableView doesn't scroll when number of items is less than scrollable limit

I've a UITableView and I populate data from a service. When the number of rows is higher than what could be displayed on the screen, I'm able to scroll the table. But when it's less (say 1 or 2), I'm unable to scroll (in the sense, the bouce effect doesn't work making the UI appear odd).
I think this should be fixed by some IB checkbox, but not sure how to do it. Anyone faced this issue before?
The solution that worked for me was to set bounces to YES programmatically in viewDidLoad.
I also have bounces set to YES using the checkbox in IB. It does appear to be taking the IB value because bouncing will work after I've pushed another view controller onto the navigation controller stack and then popped it back off. However, bouncing won't work when the table view first appears unless I set bounces to YES in viewDidLoad.
Click on the table view and look at the Attributes Inspector. There's a checkbox for Bounce Scroll. (I just tested this in a project that had a 2-line table; disabling it prevented scrolling, enabling it allows the short table to bounce)
I think the programatic equivalent is the bounces property.
Do you have this table view as a cell inside another table view?