I've been stuck on this issue for some days and couldn't figure out a solution.
Background:
I were rebuilding a code which built on XCode 4 to XCode 6 for making it compatible for iOS 7 and 8. On doing so, I found a weird problem as described in title, the UISearchbar gots invisible when tapping searchbar.
Since the codebase I'm working on is very large, I decided to reproduce this in a sample application and posting the details of sample app here.
As like in this image attached, UISearchBar is inside a UIView contained in a UITableView.
On tapping searchbar, it gets transitioned to some other location on left as like this.
PS: I couldn't take searchbar out of view and place it in tableview as it is creating some other issues in navigation. So please provide a solution which can make the searchbar positioned to its parent view itself.
Thanks in Advance.
Explicitly setting frame for UISearchBar on iOS8 solved the issue for me.
CGSize screenSize = [UIScreen mainScreen].bounds.size;
self.searchController.searchBar.frame = CGRectMake(0.0, 0.0, screenSize.width, 44);
Related
My app use uitabbar and uinavigationbar.but I encounter a problem in iOS7.1. if I switch page between one with navigationbar and one without navigationbar. the page have scrollview or uitableview,every time swith,self.view.frame or self.view.bounds is Correct,but scrollview or uitableview's frame is Correct but bounds.y every time swith will change 20px.one up,one down.
i try to change scrollview or uitableview's bounds.y in view will viewWillAppear.
CGRect bounds = contentScrollView.bounds;
bounds.origin = CGPointMake(0, 0);
contentScrollView.bounds = bounds;
but if i do it,ok,every time swith page is show right,but when i drag the scrollview or uitableview,the layout incorrect.
the demo has upload on github:https://github.com/KingCentLee/HSText
I hope someone can help me.the demo in iOS 7 later is normal. just iOS 7 swith page encounter the problem.and can tell the reason.Thank you.
I have seen your code. Try delete the code in viewWillAppear. I'am sorry, I don't have ios7 device. In my memory, it may cause by the system status bar which height is just 20px. This is only a suggestion. ps:I can't add a comment.
I am developing an iOS 8 app with a Notification center widget. One problem I am having is that when I first open the widget, the UIButtons (which are in one UIView) are stretched vertically (even though I did not specify this).
When the user closes notification center or swipes to the notifications tab and then goes back to widgets, the UI returns to its normal state and is perfect and works exactly how I want it to look and behave.
So to confirm, I am only having this issue when the user installs the app and adds the Widget to Notification center for the first time. Then as long as they don't get rid of the widget from the notification center, then its UI is normal. It is only when the user removes and adds the widget again when this issue then happens again (once only).
I am not using Auto Layout (yes I know its recommended, but I can't stand it) and my app is iOS 8 only.
More to the point, once the uses closes notification center or simply swipes to the notifications tab and then returns to the widgets section, my widget UI works perfectly with no issues what so ever.
I have tried to manually set the height of the view containing the UIButtons myself, but it doesn't seem to work. I used this code to do that:
CGRect newFrame = CGRectMake( xCoordinate, yCoordinate, width, height);
myView.frame = newFrame;
Has anyone else experienced this issue? And if so, any ideas on how I can go about fixing it????
Thanks, Dan.
Oh urmmm... ok I literally just fixed this issue by doing the following:
So I basically got rid of the vertical resizing property on the UIView which contains the UIButtons and its fixed....
I must admit, this is odd though because since I want the view to resize (to the size of the view but not longer), this is why I selected this property.
More to the point, for the main app, I had to select this property for the view to resize properly... hmmm.. I guess iOS Widget views resize differently or something.
Oh well, issue fixed :)
I have an iOS project with a splitviewcontroller that is created in code. After building this on iOS8 the master (navigation side) of the splitviewcontroller is not resizing on rotation and maintains the height of whatever orientation the app was started in. In all previous versions it would take on the size of the view.
I've traced through - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator
and even tried to manually set my view's heights from there but it always keeps the starting height.
Any help with this is appreciated. I recognize that I don't have a lot of information included in this question but I am hopping there is a common issue that I'm not aware of with the iOS8 upgrade.
Thank you
The problem in my project was that I was using a very outdated UIWindow that had some random incompatibility with iOS8. My solution was simply to just create my UIWindow in code [UIWindow alloc] rather than rely on the old .xib I was.
I have a UISearchBar attached to the top of the table view. The idea is that when you drag down from the top you can search.
So under iOS 6 I have attached the search bar and then in the viewDidLoad I "setContentOffset" to CGPointMake( 0, searchBar.frame.size.height ) which sets the content offset to 44.
This works perfectly for me.
However the behaviour is not the same in iOS 7.
After I do the setContentOffset in viewDidLoad, I see an internal call to _notifyDidScroll which sets the content offset back to 0 (after viewDidLoad has completed). The funny thing is my search bar is not at -44.
How can I make iOS6 and iOS7 behave the same way? I don't care if iOS6 starts doing this notifyDidScroll or iOS 7 stops doing it, but i'd like consistency between both versions!
For now I have had to use a horrible solution that performs different tasks on iOS 7 and iOS6.
I think you need to disable UnderTopBars in your ViewController. You can do this in the storyboard or .xib in the property of your UIViewController.
edit:
Hope that will help.
In iOS 6, my login tableview that consisted of two rows (Username and Password) was completely shown correctly. In iOS 7, the bottom row is cut off, and I don't know why or how to correct the issue. Nothing changed except for upgrading to Xcode 5 and running on the iOS 7 simulator.
UPDATE: adding more images
try playing with navigationBar.translucent property in your view controller. in iOS 6 it is NO by default, but YES in iOS 7. I had a similar issue and this fixed it for me.
Just check your UITableView frame in iOS7, may be you are running it on 3.5 inch view and it will shrink.
Looking at the provided image, I think you may be underlapping the nav bar. Or to put it another way, your nav bar is on top of hte table. Though I'm not sure why that would cut off the bottom of the login information
I've found that simply changing from GROUPED to PLAIN table view style fixes the "underlap" issue with the section #0 header, but modifies the color of the section header views. I set the tableview background color in my app. With PLAIN style, the section header background color is messed up. The section header color is close to the tableview background color, but slightly modified. This does NOT happen if I simply switch back to GROUPED. It sounds like an iOS7 bug or an Xcode bug.
The translucent = NO fixed it for some cases. In others, I ended up adjusting the tableView in viewDidLoad
- (void)viewDidLoad
{
[super viewDidLoad];
CGRect f = self.tableView.frame;
f.origin.y += self.navigationController.navigationBar.frame.size.height;
f.size.height -= self.navigationController.navigationBar.frame.size.height;
self.tableView.frame = f;
}
This is obviously some kind of issue with the grouped table view style. All I had to to was go into the storyboard scene, select the table view, then in the attributes inspector change the style from grouped to plain. It works as intended now without being cut off.