ios-autolayout

Setting auto layout constraints programmatically on two views in ViewController

ε祈祈猫儿з 提交于 2019-12-06 07:52:24
I am trying to add two UIView on ViewController. One of them is plain UIView and other is UITableView. I am not quite sure how to set height constraint on them in such away that UITableView will be of height required for its content and other view can resize itself based on UITableView height. Below is the simple sketch and code I am using for setting up those constraints. NSDictionary *views = NSDictionaryOfVariableBindings(_infoView,_infoTableView); [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"[_infoView]" options:0 metrics:nil views:views]]; [self.view

Navigation with only Back Button and transparent background

穿精又带淫゛_ 提交于 2019-12-06 05:31:38
问题 I had tried to implement Navigation Controller which embeds in my View Controller. It works as expected. But my requirement is slightly different which needs only a back button and already have a top banner with logo image background in all the screens . So if I try to implement back button it takes the space for the navigation bar which covers the Logo/top banner. Is there any way to overcome this scenario . 回答1: That seems pretty easy, by the following code used in my app too:- self

iOS8 change height of dynamic cell “now”, re internal cell content

谁都会走 提交于 2019-12-06 02:25:58
问题 Here's a dynamic cell Note - in the example, the text is not data driven. It's just some text local to the cell (consider, say, a help text). At runtime, change the .text of the UILabel from one word to many lines, using a button actually inside the cell. iOS perectly resizes the cell and table.... ... but only when the cell is scrolled offscreen, and then on again . How to alert the table view to recalculate everything "now" ? (Please note, this question ONLY in the case of iOS8+, Xcode7+,

All uitableviewcells become one line in height on iOS 9

落花浮王杯 提交于 2019-12-05 13:48:56
I have an app with several UITableView controllers. Running on iOS 8.x, the height of all the cells in each table would resize to fit the content of the cell (all contain just a UILabel with plain text). Now when running on iOS 9, every cell on every table is only one line tall. This is with both dynamic and static tables. I've scoured the UIKit diffs document and done extensive searching, but I can't find the right combination of things to get anything other than a height of one line in all the cells in all the tables. I've run into a similar case. The trick seems to be to implement the

ios 11 - UIButton inside UIBarButtonItem causes an autolayout error

巧了我就是萌 提交于 2019-12-05 07:21:44
I've a known issue with adding a UIButton into UIBarButtonItem. I've tried to add auto layout constraints as suggested in stackoveflow but I'm getting an error described as below. UIButton *sortButton = [UIButton buttonWithType:UIButtonTypeCustom]; [sortButton setFrame:CGRectMake(10, 0, 100, 30)]; [sortButton setTitle:@"Sort" forState:UIControlStateNormal]; [[sortButton titleLabel] setFont:[UIFont boldSystemFontOfSize:13]]; [sortButton setBackgroundImage:[UIImage imageNamed:@"backgroun-button.png"] forState:UIControlStateNormal]; [sortButton setTitleColor:[UIColor whiteColor] forState

In 7.3/9/2+ Swift how to disable rotation animation, when device rotates?

时光怂恿深爱的人放手 提交于 2019-12-04 17:25:54
问题 This question is strictly about iOS9+ Say you have an ordinary modern app (autolayout, storyboard, universal) which does allow all four rotation positions you want it to autorotate in the normal way, so it will change to your new constraint-based layouts when user rotates device from landscape to portrait But you simply want NO animation during the user rotating the device. You want it to just "click" to the new sideways or upright layout. The only way I have been able to achieve this is by

How to fix “Scrollable Content Size Ambiguity” in Xcode 11 (iOS 12, iOS 13) using Auto Layout

帅比萌擦擦* 提交于 2019-12-04 15:26:47
问题 When using Auto Layout, I am unable to set up a simple UIScrollView in my view controller in Xcode 11 beta. I know that I must constrain the scroll view to the edges, and then set the scroll view width and height equal to the width and height of the entire view that contains the scroll view. However, I am not getting the option to set equal widths and heights when I attempt to do so. When I do the right-click-drag from the scroll view to the entire main view, I get the following options:

How to solve: This application is modifying the autolayout engine from a background thread

旧城冷巷雨未停 提交于 2019-12-04 14:13:09
问题 This error is logged to the console when some part of the code is changing UI items from other threads than the main thread. But how can I find where it does this? 回答1: Main problem with "This application is modifying the autolayout engine from a background thread" is that it seem to be logged a long time after the actual problem occurs, this can make it very hard to troubleshoot. I managed to solve the issue by creating three symbolic breakpoints. Debug > Breakpoints > Create Symbolic

Navigation with only Back Button and transparent background

℡╲_俬逩灬. 提交于 2019-12-04 10:36:21
I had tried to implement Navigation Controller which embeds in my View Controller. It works as expected. But my requirement is slightly different which needs only a back button and already have a top banner with logo image background in all the screens . So if I try to implement back button it takes the space for the navigation bar which covers the Logo/top banner. Is there any way to overcome this scenario . Vizllx That seems pretty easy, by the following code used in my app too:- self.navigationController?.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: .Default) self

iOS8 change height of dynamic cell “now”, re internal cell content

笑着哭i 提交于 2019-12-04 08:08:55
Here's a dynamic cell Note - in the example, the text is not data driven. It's just some text local to the cell (consider, say, a help text). At runtime, change the .text of the UILabel from one word to many lines, using a button actually inside the cell. iOS perectly resizes the cell and table.... ... but only when the cell is scrolled offscreen, and then on again . How to alert the table view to recalculate everything "now" ? (Please note, this question ONLY in the case of iOS8+, Xcode7+, autolayout for dynamic cell heights.) I'm presuming you're not setting the text property of the UILabel