autolayout

iOS - proportional spacing with autolayout

一世执手 提交于 2019-12-22 03:21:22
问题 I'm trying to create a perfectly to-scale view with interface builder. So far, everything is good. I'm scaling the font, buttons, etc programmatically.. the only problem is the constraints (the spacing) between elements which remains the same. I want to avoid creating outlets for the spacing constraints because it seems messy. I want the spacing between elements to remain proportional as i stretch the element. right now everything is aligned based on the left side of the screen. if i stretch

How to position a child view relative to containing view size?

北慕城南 提交于 2019-12-22 02:31:10
问题 I want to be able to position my child view 25% the size of the super view from the top. NSLayoutConstraint *topPositionConstraint = [NSLayoutConstraint constraintWithItem:_containerView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:_childView attribute:NSLayoutAttributeHeight multiplier:0.25f constant:0.0f]; However, right now I'm getting the following exception: 'NSInvalidArgumentException', reason: '*** +[NSLayoutConstraint constraintWithItem:attribute:relatedBy

iOS 7/8 UITableView Cell: Two UILabels with dynamic height with auto layout for variable row height

自闭症网瘾萝莉.ら 提交于 2019-12-22 01:46:02
问题 So I am able to set up dynamic height sizing with auto layout when I have only one label that changes the height based on the length of the string. My problem is that if I add another UILabel that should do the same, things don't work out. I am setting both the Content Hugging priority and the Compression Resistance to 1000 for both == I get warnings of ambiguity If I set the Content Hugging (Vertical) for the second UILabel to 999 or 250 then it works great but only if the second label has 2

Table View Cell AutoLayout in iOS8

血红的双手。 提交于 2019-12-21 19:42:29
问题 I can't seem to get AutoLayout working on my Table View Cells. On some cells it seems to work, and on others it seems to not work. Even cells of the exact same kind. For example, on some cells the Description will be more than 1 lines worth of text and it will work correctly... ...Yet on other cells the Description will be more than 1 lines worth of text but only show 1 line of it with a bunch of empty space. Can you help me figure out what I'm missing or doing wrong? Thanks! I'm using this

How to change uiview's height using auto layout?

笑着哭i 提交于 2019-12-21 17:07:43
问题 So I created this scenario in order to understand how views increase in height according to their content. However am still not able to make it happen. This is what I have now: the textview is growing according to content. however the uiview containing it is disappearing. what constraints should I use so that when the uitextview becomes bigger, its parent view also increase in height? 回答1: ON UITextView make your you unselected These Scrolling Enabled Bounces Bounce Horizontally Bounce

ios 8 (UITableViewCell) : Constraints ambiguously suggest a height of zero for a tableview cell's content view

半世苍凉 提交于 2019-12-21 14:24:28
问题 I have a tableview using auto layout constraints , every thing is working in iOS 7 but when i tested in iOS 8 get me the below warning Warning once only: Detected a case where constraints ambiguously suggest a height of zero for a tableview cell's content view. We're considering the collapse unintentional and using standard height instead. After i made a profound investigations about this issue i found should add the below lines in viewdidload for iOS8 only self.tableView.rowHeight =

Autolayout is changing UIScrollView's contentOffset on rotation

北慕城南 提交于 2019-12-21 13:03:08
问题 To experiment with autolayout and uiscrollview's I have been using this example which I have edited to include 2 views in the scroll view, I have setup the autolayout constraints to position the views horizontally adjacent with their size set to fill the scroll view frame. UIView *beeView = [[[NSBundle mainBundle] loadNibNamed:@"BeeView" owner:nil options:nil] firstObject]; beeView.translatesAutoresizingMaskIntoConstraints = NO; [self.scrollView addSubview:beeView]; UIView *beeView2 = [[

Slow UIViewController load time (slow ClientState warning)

£可爱£侵袭症+ 提交于 2019-12-21 12:33:39
问题 Since I converted an old app to iOS 6 I've started getting the following message in my console. WARNING: Slow defaults access for key ClientState took 0.023656 seconds, tolerance is 0.020000 Other than updating my code from iOS 5 to iOS 6, I also switched over to auto-layout. I've run Instruments/Time Profiler and the rootViewController in my appDelegate is the problem. Everytime I switch view controllers it sucks the vast major of the time, (regardless of whether I have to instantiate the

Auto layout on UITableViewHeader

与世无争的帅哥 提交于 2019-12-21 12:21:17
问题 I've filed a bug report with Apple about this issue! I'm trying to use the new iOS 6 Auto Layout on my UITableViewHeader, but everything I throw at it comes back with the error at the end of the post. My code: TBMTableViewController.h #import <UIKit/UIKit.h> @interface TBMTableViewController : UIViewController <UITableViewDataSource, UITableViewDelegate> @end TBMTableViewController.m #import "TBMTableViewController.h" #import "UIView+Constraint.h" @implementation TBMTableViewController -

UICollectionViewCell Auto Layout

两盒软妹~` 提交于 2019-12-21 10:41:39
问题 I have made up a simple custom UICollectionViewCell in my storyboard, I also did this programatically with identical results. It has a singular UIImageView and two UILabels , like so: <--UIIMAGEVIEW--> <--UILABEL--------> |-(10px)- | | -(10px)- -(10px)-| <---------------> <--UILABEL--------> The image is sat on the left, then to the right of it are two labels above and below each other. Each are spaced out with 10 pixel gaps, and all centred on the cells Y axis. The labels then have a