Exactly what the title says. The problem is that at first it was behaving correctly, then I did something with rotation/orientation, and it started to behave this way:
https://www.youtube.com/watch?v=M4rcB8lzcpU
Now I restored the rotation thing and it still misbehaves. Question is: why?
You have to resize your DetailViewController scrollview, when keyboard appears. So that it will show you the textField appears to you. You have to add your resize code in textFieldBeginEditing: method and have to resize for old behaviour in textFieldEndEditing: method.
Related
I have implemented Force Touch in my app in the chat view. When a user force-touches the chat message bubble of the other user, his/her profile is presented. For some strange reason, when the message bubble is gently pressed, the interactive transition gets stuck and all that is visible is a screenshot of the view that is supposed to be phased out.
I've debugged this issue as well using the View Hierarchy Debugger and the UITransitionView is definitely the top-most view. The app does not crash - it is still running and the user can still receive messages but not view them, exit out of the screen, etc. because of the screenshot stuck on top.
Has anyone ever had any issues like this? Sounds like an Apple bug.
I found a reason for this bug.
If your view controller need to support preview for force touch, you need register this view controller with delegate by calling
- (id <UIViewControllerPreviewing>)registerForPreviewingWithDelegate:(id<UIViewControllerPreviewingDelegate>)delegate
sourceView:(UIView *)sourceView NS_AVAILABLE_IOS(9_0);
method to do this.
I just suddenly call this function twice (once in super class' viewDidLoad(), once in subview controller's), and when I remove once in my subview controller, this bug is fixed! Amazing...
It's still an Apple bug since it makes no sence for that happens. However, wish this answer can help developers who has the same issue with me.
FYI. I just browse your Github code, found no double calls for register method. Maybe there's other reason for this bug. You could try to remove register method in your UITableViewController's subclass. By the way, I reproduce this issue when a view controller use ComponentKit.
I modified AAPLSearchBarEmbeddedInNavigationBarViewController in Apple's UICatalog sample code so that it pushes another instance of AAPLSearchBarEmbeddedInNavigationBarViewController onto the navigation stack when a cell is selected. In the second view controller the UISearchBar set as the title view of the UINavigationBar (just like the first one) isn't tappable (unlike the first the one). This seems like a bug. How do I fix it? Here is my modified UICatalog code:
https://github.com/stevemoser/UICatalog
Also I tested with with Xcode 6 and 7. It's broken in both.
The solution is to set the first VC self.definesPresentationContext = NO when navigating away from it and making sure to call self.definesPresentationContext=YES in the view did appear so that the visible VC allows defines the presentation context.
Thanks goes to Rory McKinnel who put me on the right track.
I have an application that has 6 buttons in the navigation bar. Selecting one of the buttons cause a UIPopoverController to display. The problem is that our QE are saying that when selecting one button after the other it takes too much time for the popover to appear at the next button. Our sequence was to dismiss the current popover and create a new popover. We decided it would be faster just re-use the current UIPopoverController and call setContentViewController followed by presentPopoverFromRect with new rect and view. This seems to work fine for iOS 7. But in iOS 8 it never changes it position and after to two buttons crashes with [UIPopoverController setContentViewController:animated:] can only be called after the popover has been presented. Apparently, iOS 8 doesn't think the popover is visible anymore. Does anyone have a workaround to this issue for iOS 8 other than doing what we were initially doing? Thanks for any help.
We decided it would be faster just re-use the current UIPopoverController and call setContentViewController followed by presentPopoverFromRect with new rect and view.
You can change content of already presented popover, but you are trying to change then present. So you should first present it, then call setContentViewController (animated or not) when you are sure that popover is visible/presented/loaded.
I have a LoginViewController that you can navigate back and forth from the MainMenuViewController. I am adjusting subviews' positioning and size programmatically using willAnimateRotationToInterfaceOrientation
This works great. The problem I am having is that I need to check the orientation right when the ViewController is loaded, in case it is loaded and you are in landscape orientation, the same changes I make in willAnimateRotationToInterfaceOrientation will be made.
The problem is, the earliest point I can get self.interfaceOrientation is in the viewDidAppear method, and this causes the user to see the original sized/positioned subviews for a split second before it transitions to the landscape-appropriate sizes/positions. I tried in viewDidLoad and viewWillAppear and neither of these work because (what I believe), self.interfaceOrientation is still NULL at this moment. How can I work around this and get the changes to be made prior to the user viewing the page (viewDidAppear)?
Any help would be greatly appreciated. Thank you!
It seems like you are looking for this method :
- (void)viewWillLayoutSubviews
{
}
https://developer.apple.com/library/ios/documentation/uikit/reference/UIViewController_Class/index.html
"The viewWillLayoutSubviews method is also called after the view is resized and positioned by its parent."
After upgrading my project to iOS7
when I do a BACK Button and the UINavigationController goes back to the previous page, an ImageView on the top of the screen shifts down.
I use IB to do my layouts. These are my Simulated Metrics:
I have AutoLayout off. Any ideas on what the issue might be? I wasnt sure if anyone wants to see specific code and I didnt want to clutter up the question with too much code.
Updates: Based on the comment questions, I wanted to make these updates:
In no place in the application .h or .m file do I make any changes to the imageview's sizes or location.
In both the viewDidLoad and viewDidAppear I call a user-defined method called recalculateAll but their is no reference at all to any imageview sizes. Just for trying it out I commented out the entire section and ran the code and it still jumps down.
In my init I do programatically set some imageviews (you see the #132 in what appears to be a bubble) using their x and y's.
Here is a typical navigation I use for moving from the view controller to the tableviewcontroller:
GetTimeOffByType *showTimeOffReport = [[GetTimeOffByType alloc] initWithNibName:#"GetTimeOffByType" bundle:nil];
showTimeOffReport.timeOffType = #"Vacation";
[self.navigationController pushViewController:showTimeOffReport animated:YES];
These are all .xib files, no storyboarding at all. Its basically a view controller which has an embedded UINavigationController with 6 buttons. Each time a button is pressed it pushes a UITableViewController passing different parameters and showing different data. The transition I am using to get back to the original UIViewController is simply the iOS generated BACK button (so no code to show for that)
Update#2 Hopefully this will help someone solve this wierd behavior. So if I were to click on the table view cell on showTimeOffReport to get the cell detail and then using BACK navigate all the way back it doesnt jump down.
Update#3 Ok this is something I just discovered : The issue of jumping down or not is related to the translucency of the UINavigationBar. If you have a Translucent = YES it will start from the top of the window. If you have a translucent = NO it will start from the bottom of the UINavigationBar.
You might try setting the new property on UIViewController edgesForExtendedLayout to UIRectEdgeNone.
Here is a good resource that explains more about how view layouts changed in iOS 7.
See Apple Documentation
If you plan to be backwards compatible you will probably need to do some runtime checks and adjust positioning if the device is not running iOS 7.
This might help you..You can try adding UIViewControllerBasedStatusBarAppearance key and set it's value NO in your info.plist
UIViewControllerBasedStatusBarAppearance = NO