autolayout

UICollectionViewCell content not resizing to layout.itemSize

放肆的年华 提交于 2020-01-05 04:44:09
问题 I have a UICollectionViewCell subclass that I have defined in a nib... It uses AutoLayout to layout all of the (two, lol) components. The date picker is laid out with left, right and bottom constraints to the superview and a height constraint to make sure it always shows full content. Then, when configuring the layout of the collection view I use this... _layout = [[UICollectionViewFlowLayout alloc] init]; _layout.itemSize = CGSizeMake(CGRectGetWidth(self.collectionView.frame),

How do you balance Auto Layout with creating frames?

橙三吉。 提交于 2020-01-05 02:55:32
问题 When I'm creating a frame in iOS with CGRectMake() , be it setting the frame property or using initWithFrame: , it asks for the x, y, width and height. I supply these. But with Auto Layout, I'm next going to say something like: "position its x in the very middle" and "set the width to half the screen", right after I set those with CGRectMake() likely differently. What do I set them as in CGRectMake() ? 0? An arbitrary value? Something close to what I want? 回答1: When using auto-layout, you

How do I properly set up a scrolling NSTableView using Auto Layout? What I've tried has odd glitches

社会主义新天地 提交于 2020-01-04 06:45:30
问题 I am trying to use Auto Layout to set up scrolling in NSScrollView to scroll a view-based NSTableView. I have a few issues. The most obvious is: if all the rows are visible, the table can still be scrolled down by one row. For instance, take these before and after shots of the program at the end of this post: I am guessing that the NSTableHeaderView is overlapping the NSTableView, but I tried adding constraints that set the top of the NSTableView's NSClipView to both the bottom of the header

iOS 8 CGAffineTransformMakeScale + autolayout not working any more

冷暖自知 提交于 2020-01-04 06:27:50
问题 There seems to be a some post related to my problem but none seems to help. How do I adjust the anchor point of a CALayer, when Auto Layout is being used? I have a scaled preview of my app (as a tutorial), which the standard view (and viewcontroller) scaled down and shown on another view. ============= = = = --------- = = - - = = -Preview- = = - - = = --------- = = View = ============= For this I use this code: previewViewController.view.transform = CGAffineTransformMakeScale(scale*2, scale*2

iOS - Updating auto layout constraint constant stops working after pushing another view controller then returning

醉酒当歌 提交于 2020-01-04 06:00:41
问题 I have a UIViewController designed in IB (Storyboard) that has a UIView containing a few controls. The UIView has an auto layout constraint to fix its height. In my UIViewController subclass I have an IBOutlet NSLayoutConstraint (ivar) wired to the height constraint so that I can adjust it in code. Depending on user events, I expand/shrink the height of the UIView by modifying the constraint's constant property between 80 and 44, which also slides up/down a UITableView which is constrained to

Can you actually link constraints to utterly different view controllers?

对着背影说爱祢 提交于 2020-01-04 05:25:12
问题 Imagine you have a screen which has a number of view controllers (with container views, or whatever). (If you like, think of an iPad app with many large, complicated areas, each with their own sub-container views for lists, controls, etc.) Even - it may be that you have VCs which are hidden, slidden off screen, perhaps even just in cache and not presented, or you may have a number of screens "stacked on top" of one another so some are not even visible. So say you have a view v var v: UIView

AutoLayout Xcode6: Need autolayout constraints for this:

混江龙づ霸主 提交于 2020-01-04 04:40:07
问题 I am new in autolayout (I am good in autoresizing). My requirement is:- I have 2 view (say blue and green, width and height of both view is 300 pixel in iPhone5). height and width of both view can change according to screen resolution. X and Y origin can also change. What constraints should I use for this autoresizing masks. 回答1: It is unclear if the blue and green are siblings or if one contains the other. If the effect you want to achieve can be produced through an autoresizing mask, then

UITableViewCell UITableViewAutomaticDimension problems when starting from the bottom

淺唱寂寞╮ 提交于 2020-01-03 21:56:28
问题 I have an interesting problem. I have a very basic tableview with a bunch of cells of varying height. It's using the iOS 8 UITableViewAutomaticDimension and auto layout constraints. @interface ViewController () <UITableViewDataSource> @property (weak, nonatomic) IBOutlet UITableView *tableView; @property (strong, nonatomic) NSArray *sentences; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; self.tableView.estimatedRowHeight = 44; self.tableView.rowHeight =

UITableViewCell UITableViewAutomaticDimension problems when starting from the bottom

家住魔仙堡 提交于 2020-01-03 21:55:48
问题 I have an interesting problem. I have a very basic tableview with a bunch of cells of varying height. It's using the iOS 8 UITableViewAutomaticDimension and auto layout constraints. @interface ViewController () <UITableViewDataSource> @property (weak, nonatomic) IBOutlet UITableView *tableView; @property (strong, nonatomic) NSArray *sentences; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; self.tableView.estimatedRowHeight = 44; self.tableView.rowHeight =

UILabel appear in debug view hierarchy but not in the application

自闭症网瘾萝莉.ら 提交于 2020-01-03 12:27:03
问题 I have a UIView that I added in ViewController through the Interface Builder. In my code, I create a label in this UIView every time that a button is pressed: func addToDisplay(stringToDisplay: String) { let label = UILabel(frame: CGRectMake(0, 0, 10, 10)) label.text = stringToDisplay label.textColor = UIColor.redColor() label.textAlignment = .Right label.sizeToFit() label.adjustsFontSizeToFitWidth = true label.minimumScaleFactor = 0.5 label.setTranslatesAutoresizingMaskIntoConstraints(false)