Can't touch the button

AlexanderPAlexanderP USMember ✭✭

Hello fellow programmers.

I have a very strange problem.
If I create a very basic application, where I use a UITabBarController with 2 views (each view is in landscape mode and has a button at the right side of the view) and present it inside a UINavigationController, then I can't touch the button. I can't press it at all.
However, if I change from tab1 to tab2 and back to tab1, then I can touch/press the button.

Do you have any ideas?

Sample Xamarin.Studio solution is attached.

Posts

  • AlexanderPAlexanderP USMember ✭✭
    edited February 2014

    The guy here seems to have the same problem as me:
    https://forums.xamarin.com/discussion/11332/touch-not-responding-on-uitabbarcontroller

    I borrowed the image:

    It is actually the whole right side of the view, that is not responding. So if I have a UITableView there, I will not be able to scroll the table (if the scroll gesture origins in the right side).

  • AlexanderPAlexanderP USMember ✭✭

    Solution

    I found the solution, finally.
    The complete problem and solution (Obj-C) is described here: iOS7-setting-selectedindex-of-uitabbarcontroller-breaks-touch-events-along-right-side

    The container view that the tab bar controller sets up to contain your view controller is not being resized to account for the interface being in landscape orientation. It's dimensions at the time your view controller is displayed are 768 (width) x 1024 (height).

    The solution is to set the right frame/bounds in UITabBarController:
    public override void ViewDidLayoutSubviews () { base.ViewDidLayoutSubviews (); SelectedViewController.View.Superview.Frame = View.Bounds; }

Sign In or Register to comment.