constraints

Move all subviews to container view keeping positions and constraints

喜欢而已 提交于 2019-12-03 22:17:48
I'm using Xcode 5 and autolayout in my project. I have a .xib file with a lot of subviews and constraints between them. Now I need to create an intermediate fullscreen container view and put all subviews there. So now I have view->subviews , and I want view->container view->subviews . When I do this in IB by dragging subviews into container view, they all get centred and all constraints get lost. It's going to be a little hard to restore all constraints manually. Is there a smart way to do this keeping all subviews' positions and constraints? Add your container view to the hierarchy (to get an

Query to find all FK constraints and their delete rules (SQL Server)

五迷三道 提交于 2019-12-03 19:21:16
问题 In SQL Server 2005, can I issue an SQL query to list all FK constraints on tables within the DB, and show the delete rule? (ie nothing, cascade, set null, or set default) The output I'm looking for is something akin to: FK_NAME ON_DELETE ================================== FK_LINEITEM_STATEMENT CASCADE FK_ACCOUNTREP_CLIENT NOTHING 回答1: You can try this: SELECT name, delete_referential_action_desc FROM sys.foreign_keys 回答2: Little late to the game here, but you might also try this: select *

What is the reason for the remaining vertical spacing between an “inner”-view and the contentview of an UITableViewCell using Storyboard?

白昼怎懂夜的黑 提交于 2019-12-03 18:03:29
问题 I am using storyboard in an iOS/xcode project with the following simplified "hierarchy" (from top to bottom): ViewController (not a TableViewController for some customizing reasons) View TableView (and some other content that does not matter I think) Cell ContentView "AnyView" (specific type seems to be irrelevant, as the following happens for every item I tried) When I set the constraints between AnyView and ContentView to Zero Spacing for Top/Bottom/Leading/Trailing there is still quite

Auto-Layout Issues: iOS 7 vs iOS8

有些话、适合烂在心里 提交于 2019-12-03 16:41:41
I am trying to create a collapsible toolbar that works like this (running in iOS 7 -- ugly colors etc. for visualization purposes): However, when I run the code in iOS 8, this is what happens: I have set up a constraint system that is based on the following: A centering view (not shown) keeps the toolbar in the screen middle. A sizing view is adjusted to collapse the toolbar. The sizing view is anchored to the right of the centering view (via a trailing constraint). A container view holds the actual content of the toolbar. It is anchored to the right of the sizing view (also via a trailing

Can I name my constraints with JPA?

旧城冷巷雨未停 提交于 2019-12-03 16:04:56
问题 When I use the maven-hibernate3-plugin (aka hbm2ddl) to generate my database schema, it creates many database constraints with terrifically hard-to-remember constraint names like FK7770538AEE7BC70 . Is there any way to provide a more useful name such as FOO_FK_BAR_ID ? If so, it would make it a tad easier to track down issues in the log files and other places where the violation doesn't tell you anything other than the constraint name. 回答1: As of JPA 2.1 it is possible to give a name to

The values of one column cannot be greater than another

﹥>﹥吖頭↗ 提交于 2019-12-03 15:28:21
I am trying to create a table where the values in one column can't be greater than the next column over. For example, I am creating the following table. CREATE TABLE Price ( PriceID INT PRIMARY KEY IDENTITY (1,1), OriginalPrice FLOAT NOT NULL, CurrentPrice FLOAT NOT NULL, Discount FLOAT, ShippingCost FLOAT NOT NULL, Tax FLOAT NOT NULL); And Current Price cannot be greater than OriginalPrice. So what I tried doing was CurrentPrice FLOAT CHECK (CurrentPrice <= OriginalPrice) NOT NULL, But this gives me the following error: Msg 8141, Level 16, State 0, Line 1 Column CHECK constraint for column

Solving the Zebra puzzle (aka. Einstein puzzle) using the clpfd Prolog library

爱⌒轻易说出口 提交于 2019-12-03 15:20:52
I have been given an exercise to solve the zebra puzzle using a constraint solver of my choice, and I tried it using the Prolog clpfd library . I am aware that there are other more idiomatic ways to solve this problem in Prolog, but this question is specifically about the clpfd package! So the specific variation of the puzzle (given that there are many of them) I'm trying to solve is this one: There are five houses The Englishman lives in the red house The Swedish own a dog The Danish likes to drink tea The green house is left to the white house The owner of the green house drinks coffee The

How to programmatically increase the height of UIView with Swift

不打扰是莪最后的温柔 提交于 2019-12-03 15:20:31
问题 Inside IB I have a viewController with a segmentedControl and 2 containerViews. In each containerView I have a tableView. From each tableView I push on a detailView. My auto layout is in IB. Once I pick a segment, I see the corresponding tableView, I pick a cell and the correct detailView gets pushed on the scene. The issue is once the detailView gets pushed on the segmentedControl is still visible. I decided to hide the segmentedControl which works but there is a big empty space there. I

How to use an auto incremented primary key as a foreign key as well?

两盒软妹~` 提交于 2019-12-03 14:18:49
This is what I'm trying to do: I have 2 tables... CREATE TABLE `parent` ( `id` int(11) NOT NULL AUTO_INCREMENT, `data` text, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; CREATE TABLE `child` ( `parent_id` int(11) DEFAULT NULL, `related_ids` int(11) DEFAULT NULL, KEY `parent_id` (`parent_id`), KEY `related_ids` (`related_ids`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; And then a constraint: ALTER TABLE `parent` ADD FOREIGN KEY (`id`) REFERENCES `child` (`parent_id`); As you can see the table parent has an auto-incremented primary key "id", which is also being used as a

Can't programmatically set NSLayoutConstraint multiplier in swift… \"Cannot assign to the result of this expression

匆匆过客 提交于 2019-12-03 13:53:07
I am trying to programmatically set the constraint for a multiplier in swift, and when I set the value, it just gives me the error, "Cannot assign to the result of this expression"... I declared the NSLayoutConstraint with an IBOutlet, and then set the multiplier, same as I did with the constant for another, which works fine, but this one won't accept it... @IBOutlet weak var clockWidthConstraint: NSLayoutConstraint! override func updateViewConstraints() { super.updateViewConstraints() confirmTopConstraint.constant = 40.0 clockWidthConstraint.multiplier = 0.1 // Gives me the error! } Any ideas