I have a uitableview controller which is a subview to a view managed by a uiviewcontroller. nothing really out of the ordinary but the tableview tracks gestures on the wrong axis(only on device).
Basically you scroll up/down table doesnt do anything, and left/right scrolls table up/down. its super weird. i was hoping somebody has seen this before and maybe know what causes it?
Edit: heres a video
http://c.drunknbass.com/EB7m
at the end i am scrolling a uiscrollview that scrolls normally and is a child of the same uiviewcontroller.view
UIKit relies on there being a key window, and that window having a root view controller, to be able to correctly handle events, and forward them to your code. I suspect that perhaps one of those things is not set up correctly in your app. (Such that the device orientation isn't matching up with the visual orientation of your UI.)
Also note that prior to iOS 5, making one controller's view the child of another controller wasn't really supported by UIKit. It can be done, and mostly works, but you are going to have to manage the forwarding of all of your lifecycle events. (See the notes on controller containment in the docs, and the description of -automaticallyForwardAppearanceAndRotationMethodsToChildViewControllers as well.)
Related
I can produce a small project to illustrate this, but I think it's faster, and easier, if I simply describe it.
I have this widget I wrote. It displays a "floating" UITableView over everything else. It does this by adding itself to the main window root view controller.
However, if I am trying to display it in a popover, the table comes up under the popover. I should add that it will overlap the popover boundaries. It should not be contained in the popover.
What's the most correct way to get it to appear over the popover?
OK. I solved this, by simply attaching the table to the main view.window instance.
This seems to work in all my tests (including things like split view, and popover view).
I have not read anything that indicates that I should not do this. Apple has already passed a couple of TestFlight releases that have it, so it didn't ring any alarms for them.
I am a total noob developing iOS applications and I'm working in one right now.
I have set up my storyboard with a HomeViewController (main) and inside this, a container view, with another view controller embeded. This child view controller is outside the bounds of the view, and when a click a button in my HomeViewController it gets animated to the top of my app, showing this child with a cool animation. Everything is right.
In my child view controller I only have 3 buttons, and when they are displayed on the screen with this little animation, they are not usable. They don't trigger the action of the button being pressed nor they get "highlighted" with iOS style. Nothing happens.
I have been searching a lot about this, I have tried addChildViewController() on parent, didMove(toParentViewController: UIViewController) on child and I also have added it programmatically. When added programmatically it works OK but the view does not respect the animation, just being displayed in the screen without following the parent's container, which indeed moves with the animation.
What should I do next?
Thank you very much
Edit: My question does not seem to be a duplicate of UIView animations canceling any touch input
I'm using Spring library for the animations. Also, in that thread they are talking about user interaction being blocked while animation isn't finished. That is not my case. Animation is perfectly finished when trying the button interaction.
From my experience, there are two issues which cause this behavior most often:
Some of your container views have userInteractionEnabled set to false, or
Your container view frame is small and you're attempting to tap a button outside the frame of the container which won't work. Consider it like a window to the button and there's an invisible wall blocking touches.
Both of these are best debugged using the Xcode Debug View Hierarchy, or you can also try the Reveal app and see what's going on there.
Finally, this misbehavior was because the wrapping view in my container was smaller than the container, but as these two were out of screen I didn't realise at first. Making the wrapping view big enough to fit the child container was the solution.
Sorry because at last this was a stupid question.
Thank you all
If you use auto layout. You may check out your constraint is correct or not. Especially for biggerOrEqual and smallerOrEqual constraint still need a concrete constraint. eg:
width = 100#750
width <= superView.width#999
You should not forget the first constriant.
I have two viewcontrollers. When the user clicks a button, the parent vc uses presentviewcontroller to call the subview. The problem I am having is when the user rotates the iphone in the subview then closes it, the parent view does not fit the whole screen (it turns to landscape but only displays on half of the screen). Is there a way to let the parent vc know it needs to rotate when it happens in a subview?
Also note that the parent view rotates perfectly when the rotation takes place in its view.
Your problem may be related to this previous [question][1]: View rotation notifications: why didRotateFromInterfaceOrientation: doesn't get called?
But I am also a bit unclear about your terminology. I think you're using sub-view to refer to a subordinate VC, rather than a subordinate in the View Hierarchy.
Since you have two VCs you need to make sure that rotation handling code is present for both, and that the handlers are receiving the notifications. I suggest putting in diagnostic code in the rotation handlers for both VCs to see which is being called, and when - that should give you enough information to solve the problem or at least to post a followup.
I have implemented a pull to refresh control using UIRefreshControl with a UICollectionView. It works well, however, when I pull the collection view beyond the point where it initiates new data fetch, collection view jumps down by what seems to be navigation bar (plus status bar) height, i.e. the motion is not smooth.
I first thought this might be because of iOS7 content offsets, but this happens in iOS6 as well.
Any ideas what can be wrong or what I should check?
From UIRefreshControl reference:
Because the refresh control is specifically designed for use in a
table view that's managed by a table view controller, using it in a
different context can result in undefined behavior.
Basically, saying that it will play nicely only when used inside UITableViewController. When used elsewhere, this weird bounce occurs.
In my view I am using a UITableView that is controlled by a UITableViewController on the top half of the screen. The remaining screen is used for a UIScrollView that contains a view that is controlled by the main UIViewController.
When I perform a pull down to refresh in the UITableViewController, (for some reason if the number of table entries is less than or greater than the initial load value, the UIScrollView in the main UIViewController's frame gets changed to the screensize...
Essentially it breaks my paging unless I reset the scrollview back to the intialized size...
I have no idea why this happens as the UIScrollView is not used in the UITableViewController. The only scrollview that is used in the UITableViewController is the UITableView's to handle pull down to refresh...
Does anyone know why the main UIScrollView's contentSize gets changed randomly when it shouldn't even been accessible from the UITableViewController class?
Thanks
Just tried it here, and I can't duplicate your experience. I'm guessing you have an unexpected or inconsistent view/controller hierarchy? Look at the controller of the table and scroll views' common superview. Anything fishy there? Remember: view controllers manage sets of views. Container view controllers manage other view controllers and have special rules (see: The View Controller Programming Guide, esp. -addChildViewController:, etc.).
I'd suggest opening a blank project and trying to recreate the problem in its simplest possible form. If it's magically fixed, what's different? If it's still giving you trouble, send us a link so we can see the details of how you have things wired.