autolayout

How to force “Respect Language Direction” from RTL to LTR and vice versa

对着背影说爱祢 提交于 2019-12-18 06:06:13
问题 I have an application which uses Auto Layouts. The app switches RTL and LTR languages perfectly when the user selects he's or her's device phone language. All texts are localized, and language directions are working. I also have a button inside the app, to change it's language without restarting the app. This also works great, and all texts are being replaced. The problem is that when the user changes the language from within the app, "Respect Language Direction" option in the constraints i

Xcode6, iOS8 and (void)layoutSubviews

爷,独闯天下 提交于 2019-12-18 04:52:47
问题 I have custom UILabel which works fine on iOS6 and iOS7. But on iOS8 this label's (void)layoutSubviews method never get called. I create this label with initWithFrame, so this method should be called - and it's called on another iOS versions. What happens with autoLayout system in iOS8? 回答1: I just want to add this answer because the question title may lead a lot of ppl here with similar issues (like me). With iOS 8 to 8.0.2 LayoutSubviews calls are unreliable. They may not be called ever or

Make UIView fill containing view using auto layout in Interface Builder instead of code

≡放荡痞女 提交于 2019-12-18 03:57:06
问题 How do I use auto-layout to make a child view fill its parent, or at least anchor all its edges to the parent view's edges? I am using all four vertical and horizontal constraints in "Spacing to nearest neighbour", but when I run the app on a 3.5" device, the height of the view has not been automatically adjusted from 568 to 480 as expected. 回答1: Pin the top space to superview, bottom space to superview, leading space to superview and trailing space to superview. Then set edit the constraints

Keyboard handling just like in Messages app in iOS 7

大兔子大兔子 提交于 2019-12-18 03:33:18
问题 I am implementing a view that is in some way similar to what happens in Messages app, so there is a view with UITextView attached to the bottom of the screen and there is also UITableView showing the main content. When it is tapped it slides up with the keyboard and when keyboard is dismissed it slides back to the bottom of the screen. That part I have and it is working perfectly - I just subscribed to keyboard notifications - will hide and wil show. The problem is that I have set keyboard

Auto Layout constraint change does not animate

爷,独闯天下 提交于 2019-12-18 02:48:14
问题 I was learning the auto layout with animations from the tutorial http://weblog.invasivecode.com/post/42362079291/auto-layout-and-core-animation-auto-layout-was and things were working perfect. When I tried to use this concept in my application, trying to animate a settings screen(a UIView) from bottom to top,it works great when the settings screen is just an empty UIView, But in case I add a UILabel as a subview to this settings screen, the animation just vanishes. On removing this UILabel

Working with AutoLayout in Portrait and Landscape

依然范特西╮ 提交于 2019-12-17 22:46:06
问题 Auto Layout, as good as it is, driving me crazy with constraints. I have the portrait mode designed in IB but I can't get the desired landscape orientation to work. Notice that when the orientation changes to landscape, the spacing between the UIImageView blocks decreases and the text alignment of SAMPLE TEXT changes to right aligned. Currently, I have added a few constraints for it to work. However, I need to keep the space between UIImageView blocks fixed, as a result of which it looks

Automatically adjust height of a NSTableView

帅比萌擦擦* 提交于 2019-12-17 22:35:22
问题 I have asked this question once before, but I'm just not very satisfied with the solution. Automatically adjust size of NSTableView I want to display a NSTableView in a NSPopover , or in a NSWindow . Now, the window's size should adjust with the table view. Just like Xcode does it: This is fairly simple with Auto Layout, you can just pin the inner view to the super view. My problem is, that I can't figure out the optimal height of the table view. The following code enumerates all available

UIScrollView wrong offset with Auto Layout

人走茶凉 提交于 2019-12-17 22:30:28
问题 I have a fairly simple view configuration: A UIViewController , with a child UIScrollView and a UIImageView in this UIScrollView . I set the UIImageView with a height sufficient to break out of the visible area (ie. higher to 1024pt ), and set the Bottom space to superview constraint of my UIImageView to a fixed positive value ( 20 for example). The whole setup works as expected, the image scrolls nicely in its parent. Except when the view is scrolled (the effect is more visible if you

Use autolayout to set dynamic UIView to match container view

蹲街弑〆低调 提交于 2019-12-17 21:58:19
问题 I have a UIView in IB that has another UIView within it, which I am using as a container view. In code, I create three different views and then animate the appropriate one into the container's view depending on the state of the app. Only one of the three different views will be valid at any given time. The problem is, when I run on different iPhone's in the simulator, my new subviews are not scaled to match the container view. I am using autolayout. For testing purposes, I've set up my

UILabel not wrapping text correctly sometimes (auto layout)

瘦欲@ 提交于 2019-12-17 21:55:39
问题 I have a uilabel setup in a view. It doesn't have a width constraint, but its width is instead determined by a leading constraint to the thumbnail image, and a trailing constraint to the edge of the view. The label is set to have 0 lines, and to word wrap. My understanding is that this should cause the frame of the uilabel to grow, and indeed it does sometimes. (Previous to auto layout, I would calculate and update the frame of the label in code). So the result is, it works correctly in some