UIView inserted into UIWebView's scrollview, is not clickable in landscape mode - ios

so basically, for reasons in this answer ive put a UIView inside a webview so that it acts as a header to the view. its works perfectly for ipad, but on iphone when the webview is rotated landscape, the header UIView isnt clickable.
ive tried in the - (void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation to explicitly set the userInteraction = true of the header view but this didnt work.
i tried removing it from the superview and adding it back, but to no avail.
i have some debug code that lets me see the class of the view im clicking on, and when i click on the header view i can see its clicking on the scrollview behind it (which is part of the webview). so it just seems to be ignoring the view completely (even though it works in portrait mode, and works in landscape and portrait on ipad).
does anyone know why the click events are going straight though the uiview?
update:
something interesting ive found is that if the webview doesnt resize when the view rotates, then the header is still clickable, so it must be something to do with the resizing of the webview screwing things up
also, the background from the scrollview is like coming through the header view it seems (header = grey, scrollview = yellow) pics here. when rotated back to portrait the grey shows up again and is clickable

Give the scroll view a background color to see where it is. If the button is outside of the scroll view it is still visible (if clipsToBounds is NO, which it is by default) but not clickable.
Find out where the superview of the button is and make the resizing in a way that it is big enough after resizing.

strangest solution, but instead of having the header view autoresize in all directions, i set it like so
something strange must have been happening and making its frame set wrong somehow

Related

Transparent space above 1st section in table view after rotate

I have a split view controller, as the master view I have a UIViewController. That UIViewController has a toolbar and a tableview inside it.
If I rotate the the split view to portrait and then back to landscape I see a space above the tableview that is transparent. When I scroll the tableview up a little I see the table contents appear in that space.
Whats weird is that it only happens when I rotate the device and then rotate back again. The table view is fine at first but something seems to get messed up after a couple of rotations.
Here is a screenshot of it after I rotate a few times:
Here is a screenshot before the rotation (looks great):
I have tried to force it to re layout with setNeedsLayout, but no luck.
Any clue???
Try setting self.automaticallyAdjustsScrollViewInsets = NO; in viewDidLoad of ViewController. This will be YES by default.

UIScrollView works on 4-inch, doesn't respond to any touch on 3.5-inch

I have a strange problem where I have a scroll view on one of my views that works perfectly on 4-inch devices, both in simulator and actual device. That same scroll view (and views inside it) doesn't respond to any touch event (both tap and scroll) in 3.5-inch devices (same iOS version, 7.0.3). It renders/displays perfectly though. I've even tried to add a tap handler to the view itself directly to see if it will hit (categoriesScrollView is my view):
//viewDidLoad:
UITapGestureRecognizer *test = [[UITapGestureRecognizer alloc] initWithTarget:self action:#selector(test)];
[categoriesScrollView addGestureRecognizer:test];
-(void)test{
NSLog(#"test");
}
It doesn't hit. Inside the view there are buttons, that can be tapped perfectly on an 4-inch device. This problem occurs both on device and simulator. The first thing that I checked was any device/screensize-specific code, but there isn't any. The second thing I've checked is the layout constraints: Maybe the scrollview's actual bounds was getting smaller (maybe even zero) on 3.5 inch device, but I've checked the frames and everything is normal (the scroll view has clipsToBounds set to YES anyway, so if this was the case, the content would be invisible anyway).
All the other views inside the same view other than this scroll view and its subviews are receiving touch/running perfectly normal. I can't think of anything else, what can be causing this?
I've solved the problem. I've first put another button somewhere inside the main view on top of the scroll view (but scroll view was inside another container, top bar), the button worked. I've then moved the button inside the same container with scroll view (on top of it), and it didn't work where alarm bells rang for me. Apparently, I had a progress indicator and that indicator was centered in the main below with top constraint to the top bar. Top bar had clipsToBounds set no NO and the indicator was pushing the size of the top bar to almost zero, making the scroll view draw but not respond to touch. It was a simple autolayout issue, and the top bar which contains the scroll view didn't clip the scroll view out of it's bounds, which made the bug harder to find.

iPad UITableView top right corner covered with white box in landscape popover

I am attempting to create a custom popover for an iPad application in landscape orientation. I created a new UITableViewController with static cells on my storyboard and set the size setting to "free form". I then set the size of the UITableView to my desired size. I connected a Modal segue from the parent controller to the new popover.
Then in the parent UIViewController I created a method that performs the segue through a custom presenter. After working through a bug in Apple's orientation handling routines, I got the popover to show at the correct location.
When I run the app, I then discovered that in the top right hand corner of the UITableView a white box is displayed that covers whatever I place in the UITableViewCell. The more cells I place in the table the longer this white box appears. So I believe it has something to do with the UITableViewCell not orienting properly although I have not figured out what yet.
I cannot seem to find what this box is, nor have I had any luck getting rid of it. Has anyone seen something like this? Any help to get this white box remove (or whatever is needed to get the cells working correctly again), will be greatly appreciated.
Thanks in advance
For anyone who is interested, I was able to work around this problem. It turns out that there is a bug in the modal segue logic that does not handle landscape orientation. So I created a XIB and presented that as my modal view. I still need to adjust things since it is landscape but the view displays correctly.
From what I understand this storyboard bug should be fixed soon.

UISplitView with UITabbar

I have a strange one that I can not seem to fix. I am currently working on updating my app to iOS7. This all worked in iOS6. It is an universal app and thus uses same xib files. However the iPad uses UISplitViews on some. Like I said, this all worked in iOS6 oh this all works on the iPhone too.
The problem is a grey bar at the bottom. I changed the tab bar to be opaque to move views up properly as i had some UI clipped to bottom of views and that went underneath the tab bar, sidetracked there. But if i set it back to translucent bar, it goes underneath but stretched properly. if i dont, it adds a bar. Other tabs work fine when NOT using splitview.
The UISplitviewController is added programmatically.
See attached image for better description.
This I have tried:
Added autoresize on splitview
Checked xib for subviews in the splitviews to have auto resize
Tried to force splitview to be screen bounds
Removed clips to bounds on all views
Removed autoresize subviews
Any ideas would be welcomed.
Thank you all.
UPDATE:
setting the background colour the uisplitview, it does colour the bar black. So the uisplitview is definitely stretching to it.
I subclassed UISplitViewController and added the line below to viewDidLoad and that fixed the grey line.
self.extendedLayoutIncludesOpaqueBars = YES;
I believe I have found an alternative solution for you. I have had the exact same problem, mostly because we are both doing something against Apple's Guidelines which is having a SplitViewController nested within a Tabbar controller (SplitView should be the root view). This was okay in iOS 5/6, but now in iOS 7 there are far too many side effects to achieve this.
The reason you see your view stretch completely when you set the bar to be translucent is because the bar is NOT taken into account when drawing the view. When you set translucent to false, it is then taken into account of the view and you will see that grey bar there because that's your view pretending there's a tabbar at the bottom of the screen.
And as always, a SplitViewcontroller's height cannot be changed, as it is determined by the visible window height.
I tried everything you did and then some. The real solution came from using a third-party Split View Controller.
I recommend switching over to https://github.com/mattgemmell/MGSplitViewController . This split view controller is actually one large View with container views living inside of it. Because of this, you avoid all the side effects of putting an actual split view controller within a tab bar.
If that doesn't float your boat, you could create your own solution which follows the same idea of having one UIViewController with two container views contained in it, though the people behind MGSplitViewController did a good job of that already.
This was the only way I was able to solve this issue, let me know if you find an alternative.
Instead of creating a subclass for UISplitViewController, I just added this code on my master's viewDidLoad:
self.splitViewController?.extendedLayoutIncludesOpaqueBars = true
For the controller that is the detail view of UISplitViewController you just do this:
-(UITabBarController*)tabBarController{
return nil;
}

Programmatically change frame of the UIkeyboard after rotation

Since i have a complex hierarchy of views i handle the rotation manually with CGAffineTransformMakeRotation.
Everything rotates in harmony, status bars, navigation bar etc. The only problem is, if the keyboard was on screen before rotation, it gets the orientation of the satiates bar but its size is not right.
How can i force it to fill the entire width and get the right height?
I tested with a single test UIview and it looks likes this.
http://dl.dropbox.com/u/15251533/iPhoneSimulatorScreenshot_20120430_133558.png
I found a simple approach to get rid of this situation.
If you call resignFirstResponder on the Textfield and afterwards becomefirstresdonder consequently.The keyboard appears in the right position after rotation.It also does not disturb the animation if you have one.

Resources