I have been using UISearchbar in my project with no problem at all in iOS7 now when i build my project using Xcode 6.0.1 and run on iOS8 the width of UISearchBar automatically changes for example
If my app is in landscape mode (iPad) and the search bar was in center and had 200 points then this width changes to full 1024 automatically.
I am not using auto layout, when i enable auto layout the issue is solved but whatever i do to change the frame in code nothing happens.
I don't want to enable autoLayout, how can i solve this problem?
I solved this problem by using following code
-(void)viewWillLayoutSubviews
{
searchbar.frame = CGRectMake(365, 0, 274, 44);
}
Hope this help someone
Related
I have a very strange problem since I updated iPad on iOS 8.1.3.
Anywhere in the app where some label needs to go with multiline (numberOfLines set on 0) it crashes on when drawing rect or on sizeToFit.
This was working just fine on iOS7.
Here is call stack when crash happens: http://s16.postimg.org/txnmngglh/Screen_Shot_2015_02_09_at_11_01_41_AM.png
Just Uncheck Autolayout & try again.
If you don't want to Uncheck Autolayout than simply add this line:
Your_TextView.numberOfLines = 0;
Hope it will work for you.
I've a problem with the scrollview in IOS 7.
at first, it didn't work at all not even on IOS 7 or IOS 8
but after I added this code:
it starts working on IOS 8 but still not working on IOS 7.
[scroll addSubView:contentViewScroll];
scroll.contentSize = contentViewScroll.frame.size;
can any one suggest a solution??
Your contentSize needs to be bigger than your frame size in order for your scroll view to be scrollable.
I've fixed the problem...
as everybody says, my content size was bigger than the scrollview frame size, but the scroll was not working. after spending hours in this issue, I've managed to fix it by fix all the warning on the controllerview. after all the warnings are fixed the scroll starts to work.
maybe this sounds stupid, but fixing the warnings got the scroll working at last
I'm struggling with an issue using constraints under XCode 5.
I am building my app for iOS7 while trying to keep iOS6 UI compatibility.
I am currently facing one UI issue using Interface Builder.
I have a table view that adjusts according to the height of the superview using the constraints (set in Interface Builder).
It works perfectly under iOS7.1 portrait and landscape orientation.
My issue is that running on iOS 6.1, the views shrinks/enlarges depending of the superview height, BUT it goes 20pixels more on the bottom. It clearly is because of the status bar.
It doesn't make sense to me , since the autolayout should take care of this , right ?
I've tried to look for solutions here obviously, but i always find ways to go from iOS6 to iOS7 while preventing the view from showing under the status bar. It doesn't quite apply to my issue.
Any help on how I could/should solve this problem ?
Thx
Update the UIVIEW Frame programmatically when its ios version < 6
if ([[[UIDevice currentDevice] systemVersion] floatValue] < 7)
{
// Update frame
}
else
{
//Update the frame in UI
}
or check the below link, maybe its helpful
iOS 7 status bar back to iOS 6 default style in iPhone app?
I am experience a rendering bug when using the default progress view. Rather than being 9px tall, the view is clipped to about 4px when using the default progress view. My app is built with the iOS6 SDK, and the issue appear when running on a iOS7 device. The interface is built with interface builder.
Is there a simple fix for this issue? Switching the style from "Default" to "Bar" in interface builder fixes the problem, but that changes the appearance.
Setting the frame in code helped me solve this.
#iPP 's answer is not the best. Setting the frame in code will cause your code to be riddled with iOS version checks, and that code tends to get very complicated when supporting multiple device orientations.
I think the best way is to use new feature "iOS 6/7 Deltas" in Xcode 5.
And "iOS 6/7 Deltas" key usage is:
When Auto Layout is turned off, you will notice an area in the sizing tab of the utility area (right pane) of Interface Builder that allows you to set iOS 6/7 Deltas. Deltas can be set individually for each view and work as you would expect. If your storyboard or nib is set to view as iOS 6, then setting the deltas will cause that view to be shifted and/or resized by the set delta amount when run in iOS 7. Alternately, if your storyboard or nib is set to view in iOS 7, then the deltas will be applied when run in iOS 6. Both of these tools help you to support older versions of iOS alongside iOS 7
for UIProgressView, here you can try to set "delta Y" to be -7px, because iOS 7 just reduce the Y origin of UIProgressView by 7 px, so when running in iOS7, we should give it back the 7px.
It's like the iOS7 cut the progress view use the iOS7 Style's frame.
You have two ways.
1. set the progress view style ---bar, you can do this in the nib file or code.
2. use the code to set the frame. Something like:
progressView.frame = CGRectMake(x,y,w,h);
The second will face the layout issue when you rotate or change the layout.
So the easiest way is set the progress view's style.
I encountered a strange behaviour of a view in an iOS 6.1 app which I tried ran with the iOS 7 beta 2 and on my iPhone.
This app has a UINaviagationController which works fine if I run it in the iOS 6.1 simulator. However, with the Xcode DP the bottom part of the view is cut off. See picture.
Does anyone know how to fix this? I am drawing the box that you see as cut off on the bottom (self.frame.size.height) of the UIView which is managed by the navigation controller.
Thanks.
try subtracting the size of the box by the amount of the toolbar at the top. When using the self.frame.size.height, it will use the entire height as the location on the view, so when subtracting by the toolbar/navigation bar, it will raise that up just enough to fit the entire box onto the view
//clearly not objc but its just to show you how to implement it
boxLocation at (self.frame.size.height - (amount of toolbar/nav bar))
Hope this helps!