alignment issues when using stack views - swift

I have a label in the top left corner that say "Categories", a back button in the bottom left corner.
In the center of of the view is a stack view containing four other stack views. All of them with 3 buttons.
Each time I run it in a simulator the category label in the top left disappears.
I've attached several photos to show current constraints and what my layout should look like and what shows in the simulator.
Thanks
View in interface builder
Constraints view

So it appears it was the image I was using as the "background picture" of each button that was causing my layout issue. I removed it and everything fits now. Thanks

Related

UIBarButtonItem Custom Image is Stretched (Xcode)

I'm creating a side menu in Xcode, and to open it I'm using a navigation view controller like the following:
I need the left bar button item to be on the left.
I added a left bar button item. Without changing it to a custom image, it is aligned to the left, as desired. When I change it to the custom image (the three lines) it stretches and aligns itself in the center. I have not written any code for this view controller yet, so none exists for the bar button item.
How can I get this aligned to the left as it should be? (Above the "Home" text).
Thanks for any help.
This is because your menu icon size is bigger.I have added two images one is with 64*64 px size which is perfect and in another icon with 512*512 px size
Hope it will help.Thank you.
You can’t use any image size for UIKit tab bar or navigation items.
Please read this guideline from Apple:
https://developer.apple.com/design/human-interface-guidelines/ios/icons-and-images/custom-icons/

UIViewController Nib Layout changes at runtime

Notice the Nib on the left displays a layout with 2 UILabels, 1 UITextView and 2 buttons. The Y coordinate of the buttons changes at runtime. What is causing this and how do I fix it?
Update #1 - Problem goes away when I shift to a iPhone Retina 4-Inch display.
Update #2 SOLVED - Problem goes away when by unchecking 'Autolayout' in the xib properties.
It looks like you're using iOS 6 and a storyboard with the 4-inch "tall" iPhone screen form factor simulated. Assuming you are using Auto Layout, you probably have a constraint added to one or both of the buttons that pins them to the bottom of their superview. When you then run your app on the 3.5" screen iPhone simulator, the buttons appear to "move up" as their superview has gotten shorter than on your storyboard.
Find the button with the icon pictured below while editing your storyboard, and click it to toggle the simulated screen size between the 3.5-inch and 4-inch form factors. You should see your buttons re-layout based on their constraints.
To set your buttons' spacing relative to the top instead of bottom of their superview, select both buttons and from the menu bar choose the Editor menu > Pin > Top Space to Superview. (Or use the Pin button pictured below directly from the storyboard.)
There's a good introductory tutorial to Auto Layout here, if you haven't learned about it yet.

IPhone Simulator - label misaligned

I have a label sitting on the the top of screen in a tab bar controller app. When I align it to the top of the screen in Interface Builder (IB for short) and then run it, the label is about 20 pixels higher in the simulator - cutting off half the label or so. I have only seen this behaviour in tabbed apps. I have played with all the align, view mode settings without success and there is no custom drawing code.
Any ideas on why label is misaligned in simulator?
I have attached screen shots of IB (left - OK) and simulator (right - bad):
Thanks,
Serge
I guess , you are facing problem because of the following reason.
Since Tab area occupies some height from bottom,You have design your view such that top of the label should align with the top of the screen(like label should start by leaving some space (20px something) at the top).
Thanks to PJR above for giving the hints. The trick is to setup the 'simulated metrics' of both tab bar controller and each of its first view controllers.
1) The tab bar controller --> simulated metric.bottom bar should be set to none
2) All view controller --> All simulated metric props set to 'inferred'.
I have provided screen shots for a fresh tabbed project created in Xcode 4.3.1 which show what needs to be done.

issue occurs when doing in LandscapeLeft

I am working to support the rotation screen in Iphone now and running into the issue. When the screen is in Poitrait mode, the position of navigation bar and its items on it looks perfectly.
When I switch to LandscapeToLeft, the width of navigation bar is stretched and it is fine.However, the position of items bar on it stay the same...Their positions are not changed at all.Therefore, there are huge room from the rightmost button to a right margin. ...I cant not attach any images so that you guys can easily see it....Sorry about that
If you were experiencing it before, please help
Any ideas are welcomed here. Thanks
PS: these itemBarButton are added by drag and drop in the toolbar in StoryBoard
Take a look at adding a "Fixed Space Bar Button Item" or "Flexible Space Bar Button Item". You can drag them into the navigation bar from the object library.

Appending a scrollview (horizontal) to a view which has a scrollview (vertical) and two labels Iphone sdk

I have developed an iphone application which has 6 cards (icons with images) in the Rootview. Clicking on a card would bring another view which the image being enlarged (fullScreen). The Card View has a Flip button which shows the back side of the Card which contains some text. Different cards hold different text on their back. Depending on the text size the view will be scrollable. I used two labels: one for title of the text and and second label having the whole paragraph. I have placed a scrollview below the two labels for vertical scrolling.
When a nth card is clicked from the Rootview the selected card should appear. It works perfectly. I used a separate view to design the front view of card and a different one for the text on the back. The issue is when a card is opened and flipped to see the text, it should be scrollable horizontally too apart from scrolling vertically. I dont want to redo anything. I have placed the vertical scrollview and the labels on the view representing back of card. I added another scrollview and enabled its paging property and wrote code in the following functions.
scrollViewDidScroll:(UIScrollView *)sender;
scrollViewDidEndScrollingAnimation:(UIScrollView *)newScrollView.
But it is not working as desired. No scrolling works (even the vertical 1 which was earlier working fine. I mean when i combing the horizontal scrolling both stop working.
How do i allow vertical and horizontal scrolling to this view which has two labels.
I would appreciate your help...
Thanks in advance
I solved it.
I used a table view to hold the card back details. So i get vertical scrolling by default.
I took a scrollview which will hold as many number of tableviews as there are cards.
And it is done