I have set autoresizing property for a search bar in xib(for iPad) as shown:
Now:
i think i should set some property in mainView of interface builder, but dont know, which property, if you have any suggestions, please share it.
if i remove both the middle one and right line then i get something like this:
Just remove right red line from XIB autoresizing View as following image shows:--
Or try removing autolayout
DONE
PORTRAIT MODE
LANDSCAPE MODE
Related
When device turn to landscape, some controls go out of viewController, and I can't drag it to viewController.
Like you can see on your screenshot you have invalid constraints, this can be a problem. If you are using storyboard or xib simple use sizeclass to define specific constraints for portirat and landscape mode. Go and checkout Apple guidelines for adaptive UI https://developer.apple.com/design/adaptivity/
If you are using Storyboard with Autolayouts(constraints),Check once your constraints,Or if you are implementing via coding, You can change frame when device is rotating.
Autolayout for landscape mode isn't working.
Here's what I see in storyboard (preview):
https://i.snag.gy/KZENBG.jpg
And here's simulator:
https://i.snag.gy/4EPsH8.jpg
As you can see, toolbar is disappearing to somewhere off the screen. I've tried both Top Space to Superview = Standart value and Top Space to Top Layout Guide = Standart value in toolbar's contraints, but got no result.
P.S. In the portrait mode everything works good.
First of all change device in preview and set it to iPhone 5 and then check looking perfect or not.If not then try to set from Size inspector from Utility area.
If this doesn't work then try this.
Delete Derived data of your project.Then run again.
Derived Data located at
~/Library/Developer/Xcode/DerivedData/(your app data)
I am working on an iOS project when I ran into this problem. When I add second scene view controller and add buttons in it, the buttons don't show up on the simulator in correct place. It is stuck up at the topmost left corner, I am not able to move it down. I tried applying constraints but they are not taking effect. Can someone please guide me? Attaching screenshots of storyboard and simulator
You have the choice to Update Your Frame or update your Constraints
You need to delete and remake new constraints. Right now your constraints are reflected in what is happening when you actually run the app, but when you move the view around in the storyboard, the constraints won't automatically update.
Click on each individual constraint and delete it before you create new constraints with different constants.
You Have to deselect the auto layout from the right side button menu.
Thanks guys for those wonderful answers. I was able to get around this issue yesterday, it is because of device orientation setting, the simulator was running in landscape mode setting, when I changed it to Portrait mode it started working. There is a setting available in bottom part of the view controller which sets the view options for different devices, I had accidentally set it to "wCompact hCompact", this setting will default the image to landscape image of storyboard on simulator. In the simulator though I was viewing it in Portrait mode. Attaching the screenshot with this setting.
I'm currently following the udemy ios8/swift course and I'm completely stuck on the navigationbar part. I'm thinking it might have something to do with the fact that I'm on a higher version of Xcode, but can't seem to find the solution.
I have to set the constraints for the navbar on 0 on 3 sides so it will be centered and full width in both landscape and portrait mode. When I try to do this, I see a option thats not there on the course (Constrain to Margins). No matter how much I try to adjust the values, the navbar keeps disappearing or moving in the wrong direction. I tried unchecking the constrain to margins function and putting everything on 0, I tried 'resetting to suggested constraints' and lots of other options, but I can't seem to get my navbar look good in both landscape/portrait mode. So basically, what am I doing wrong or is there any other way to do this?
In addition to the three constraints you need to give the navigation bar a height.
Another solution is to add a navigation item to the view controller instead of a navigation bar. A navigation item will auto format a navigation bar at the top of the view.
I've been able to fix it by manually setting the constraints to 0 in the Attribute inspector after Ctrl-dragging to create them first. Not sure if this is the ideal way, but it solved my problem for now.
I have an xib file with the image like this:
When I run it, it seems to downsize to this:
Width:320 Height:370 is the values I have given. There is a navigation bar above and a tab bar below.
Should the image show normally? it seems to be resized.. not sure why...
How do I avoid the shrinking?
Need some guidance.. Thanks...
*EDIT1 *
Huge apologies.. I am using iPhone(Retina 3.5 inch). that is why it is appearing on the middle. How do i ensure that it remains at the bottom for iphone(Retina 4 inch), iPhone (Retina 3.5 inch) and iPhone?
*EDIT2 *
in iphone 5, it looks like this:
How to avoid this?
please add bottom bar as tabbar in xib file ...
Open your xib and select your view then Uncheck the "Use AutoLayout" property from
File Inspector(Option+Command+1)
Select the image in the xib editor and set the mode to "top".
You need to set autoresizingmask of your view and imageview to UIViewAutoresizingFlexibleTopMargin if you want they stay bottom all the time.
And you need to remove UIViewAutoresizingFlexibleHeight.
You can do it with code or in interfacebuilder.