nslayoutconstraint

UITableView with self sizing cells becomes jerky when calling deleteRowsAtIndexPaths

别说谁变了你拦得住时间么 提交于 2019-12-07 20:03:07
问题 I have a UITableView with self sizing cells. Table contains 1 section and some rows. I have some rows say 30 and I want to delete row during didSelectRowAtIndexPath . When I delete a row available near the bottom of tableview (say 28th row ), the rows before 28th row changes their position and it causes jerky animation as a result of deleteRowsAtIndexPaths . See attached gifs for more details. Cells constructed with frame deletion animation Auto Resizing cells Deletion animation - (NSInteger

UIView Element Layout Constraints

早过忘川 提交于 2019-12-07 19:15:04
问题 I'm fairly new to iOS development but have reached the point where I want to create my own composite UIView as a custom UIButton. I would like to layout a UILabel and 2x UIImageViews as follows; But I would also like to anchor the controls (subviews) in such a way that as the label expands, due to translations say, the view automatically handles the extra real estate. For example; Ideally - the right hand side UIView is anchored to the right; and remains a fixed width/hight (right aligned).

What exactly does lowering the priority of a constraint do?

若如初见. 提交于 2019-12-07 17:55:38
I am constructing a variable size table view within another view. The table view should not scroll so I am programmatically determining its content size and adjusting a height constraint so that the table view always fits its content. The problem I run into is a warning about a broken constraint: Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note:

Add UISLider with Autolayout programmatically

萝らか妹 提交于 2019-12-07 11:50:53
问题 I'm trying to add a UISlider to my view programmatically including constraints so that its width adapts to the whole screen width. This is what I got so far: //2 Add UISlider self.slider = [[UISlider alloc] init]; [self.view addSubview:self.slider]; [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.slider attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1 constant:0]]; [self.view addConstraint:

iOS Constraints on Grid of Equal Width/Height Buttons cause positioning and size to vary

杀马特。学长 韩版系。学妹 提交于 2019-12-07 10:32:28
I'm updating my Calculator app to use new dynamically sized buttons and having a problem with the constraints. The contains should work fine as far as I can tell, but Xcode complains about misplaced views. The values it gives for the misplaced views are not proper and if I try to fix them, then it just causes more views to be "misplaced." In the screenshot below, the first multi-colored row (orange, green, pink, yellow, red) is a row of UILabels. They should all have equal widths with 0 spacing between them and the edges of the screen. They are in a container view (Xcode label is "Register

Deactive NSLayoutConstraint iOS7

醉酒当歌 提交于 2019-12-07 10:13:07
问题 I'm developing an app with a target of iOS7, and I get the following error when I deploy the app to an iPhone 4. [NSLayoutConstraint setActive:]: unrecognized selector sent to instance I looked into this and it turns out that setActive was introduced in iOS8. Question is, what is the alternative to setActive for constraints, circa iOS7? I need to manipulate the constraints programmatically and can't seem to find the answer anywhere. 回答1: Another way to do this would be to add/remove the

Why WKWebView doesn't display videos? - Swift 3

别来无恙 提交于 2019-12-07 08:42:25
问题 I successfully added a WKWebView programmatically In a viewController (in viewDidLoad() ). When loading a url that contains a video it appears fine, but when I try to tap on it (playing it), I cannot see it, but the audio works fine. The weird thing is I created a new project just to make sure it should works fine and it did, I copied the same exact code the webView displayed the video as it should. It was working fine before converting to Swift 3. This is how it looks when tapping on the

Autolayout confusion: Constraints for ScrollView with WebView and Header/Footer Views

狂风中的少年 提交于 2019-12-07 06:12:48
问题 To illustrate my problem, I created the following graphic: The black border around the red square is supposed to be the iPhone screen. Inside, we have in red a UIScrollView , which is taller than the screen. It is, in fact, as tall as a UIWebView , displayed above in yellow. The UIWebView is a subview of the UIScrollView , with scrolling disabled. Further more, we have two blue views, which I like to call the header and footer views. They are also subviews of the UIScrollView , but outside of

How to add Constraint programmatically in objective c

血红的双手。 提交于 2019-12-07 06:09:13
问题 I want to add constraint programmatically and I use below code to add TOP and LEFT constraint. NSLayoutConstraint *top = [NSLayoutConstraint constraintWithItem:label1 attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1 constant:110]; NSLayoutConstraint *left = [NSLayoutConstraint constraintWithItem:label1 attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeading

How to write NSConstraint visual format language by including another button's width plus a constant

Deadly 提交于 2019-12-07 02:37:02
问题 In the docs about the visual format language for NSLayoutConstraint there is an example where you specify button1 is equal in width to button2: [button1(==button2)] my question: is there a way to make button1 equal to button 2's with + a constant.. I tried: [button1(==button2+10)] and [button1(==(button2+10))] and both failed.. here is an error example: A predicate on a view's thickness must end with ')' and the view must end with ']' V:[tagWrapper(==tagButton+10)] ^' (I obviously know you