I'm a newbie for ios sdk.I've created a sample app.In that app I'm using a tableview and on clicking any cell in the table view i'm pushing a ScrollViewViewController( scrollView with pageControl ) on it.In ScrollViewViewController I'm loading the views which will have each a tabBarController.
In the tabBar there are 5 tabBarItems.And on second tabBarItem corresponds to a viewContoller which has a tableView as subview.
Here the problem is that on the second tabBarItem tableView is scrolling fine in the fist page of the scrollView.But once i swipe to the next page in scrollview and on that page if i select the second tabBarItem which loads a tableView and that tableView is not scrolling.
Please help me.
I've been struck here from more than a month
:(
Thnaks in advance.
This approach isn't really recommended.
The problem being that UITableView inherits from UIScrollView.
It's actually written in the UIWebView documentation:
"Important: You should not embed UIWebView or UITableView objects in
UIScrollView objects. If you do so, unexpected behavior can result
because touch events for the two objects can be mixed up and wrongly
handled."
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIWebView_Class/Reference/Reference.html
Related
I found a strange behavior with a UITableView when a decide to make my App compatible with landscape orientation.
I have two UITableView respectively linked to UITableViewControllers and some data.
I created a Navigation Controller linked to the first TVC and I added a segue between TVCs
I run the simulator, the first tableview appears.
I switch to Landscape mode and click on a row to view the second tableview.
I go back to Portrait Mode, and I click on the back button.
And When the first tableview re-appears, there is a strange horizontal scrolling on the bottom and I can move the tableview. It seems that the first tableview still believe to be in Landscape Mode :
I tried some changes in viewWillAppear with no results...
Does anyone have encountered this problem ?
Sometimes it could happend if you have a UIScrollview at the back of the UITableview. It is related to the rotation and the autolayout of the view. Check if you are setting the frame of the tableview or something like.
I have a tableviewController class where i am displaying my content in the tableview. Here, i want to add a scrollview below the tableview but i am not able to change the tableview coordinates. My TableviewController is in turn added to a navigation controller. As of now i am able to add the scrollview using self.view addsubview:myScrollView but it is getting added to the tableview. When i scroll the tableview the scrollview is also getting scrolled vertically. But i want the scrollview to be fixed below the tableview and i just want my scrollview to scroll just horizontally. Please help.
It seems what is happening is that you are adding a UIScrollView on top of the view stack and so causing it to rest on top of the UITableViewController instead of beside it. This is not good.
You should consider using UIViewController instead of UITableViewController. You could then subview a UITableView with a UINavigationController and a separate UIScrollView to fit the screen how you want it.
This is a pretty major undertaking, so it will be hard to demonstrate a good answer in code.
What you need to do is make your view controller a subclass of UIViewController, then add UITableViewDatasource and UITableViewDelegate protocol in your header file. If you are instantiating in NIB, toss your Tableview instance and replace it with UIView. You then hook to your FilesOwner as your view. then bring in table view object from the library and hook its delegate and datasource to file owner and you should be good! Hope this work well for you. Work well for me all the time!
I'm currently developing an app for iphone (my first) and I used several UITableViewController for navigation.
I then used a subview attached to self.view.superview to get a non-scroll image at the top.
The subview is created in IB, simple UIView with an UIImageView in it.
I'm adding the subview in viewDidAppear and this functions well.
But as soon as I'm tapping a cell and the navigationController pushes the next View animated, the previous view (scrolling out of sight) becomes completely white and my subview moves animated to the center. It's only for a half second or so, because then it's gone due to the next view arriving, but it's really unnerving.
I tried removing the subview in viewWillDisappear, that removes the UIImageView, but the screen still becomes completely white.
Does anybody how to fix this?
Oh, and PS: I'm working only on the Simulator, because I have no Developer Account yet. And I cannot change everything to a ViewController because I have a deadline to meet.
You shouldn't be surprised that things go wrong when you mess with the views of view controllers that don't belong to you. Rather than using a table view controller, you should replace it with a custom UIViewController whose view acts as a container view for both the table view and the non-scrolling view above it.
In a view of my app I subclass tableViewController and has an activity indicator shown up when the table content is loading. I put it in the center of the screen but it scroll with the tableView (I guess the reason is I add it as a subview of the table view). Is there a way that I can keep the activity indicator in the center of the screen even the table is scrolling?
You could either subclass a UIViewController instead, and set a table property, adding a UITableView as a subclass to the UIView, making it behave exactly like a UITableViewController.
Or, more simply, you could just add the UIActivityIndicator as a subview to the main window.
I have created a reusable class that fades in a "loading message" and indicator at the foot of the devices screen.
The problem I have is that when I'm adding the loadingview to a view that is contained in a NavigationController I want the view to stay at the bottom of the screen, even when scrolling the tableview.
How can i add a view ABOVE the TableView that is not affected by scrolling and such?
Add it to the view containing the UITableView so that it is a peer to the UITableView rather than a child of it. Generally, this is the UIWindow that your application delegate owns.