ios-autolayout

how to put constraints on views in interface builder to satisfy all iphone Screen in Xcode 8

北城余情 提交于 2019-12-02 13:04:35
I have been trying the following such as pinning, aspect ratio, vertical spacing ,horizontal/vertical spacing,leading/trailing space; but it is not working uniformly for all iPhone screen from iPhone se and above. You dont apply constraints for each device anymore. You apply auto layout constraints per size class. If you are aware each and every iOS devices falls under one of the size class in each orientation. If you aren't aware of size class do read about it. As to answer your question, 1. You will add constraints which are common across all the size classes to any x any. 2.you can always

How to efficiently use Autolayut and Auto-Resizing in same target?

ε祈祈猫儿з 提交于 2019-12-02 08:27:08
I have one target. It's a login based application. Because of legacy code, I am forced to use Auto-Resizing in some View Controllers whereas I have updated newer UI using Auto-Layout. If the Autolayout has to work on iPhone 6 and 7 (4.7"/5.5" screens) I have to add the launch images for these. PROBLEM : All my screen that are not using auto layout gets disturbed when I add the Launch image. If I don't use the launch screen images, all the View that use auto layout are scaled up and appears slightly bigger than expected. I do not have the luxury to update the legacy code to use auto layout. Can

I want two buttons to have equal width and position themselves proportionally in all screens sizes from the top of the scree using autolayout?

偶尔善良 提交于 2019-12-02 08:22:44
问题 Attaching the view i am planning to design. I would like to position the Buttons with respect to Superview and their Width and Height must increase proportionally to the Screen Size rather than remaining fixed. Attaching the screen preview: 回答1: This is an example just for one row of your buttons, so they can be reused for other UI elements. Put these constraints onto your buttons: LEFT BUTTON: left leading constraint top leading constraint height constraint RIGHT BUTTON right trailing

I want two buttons to have equal width and position themselves proportionally in all screens sizes from the top of the scree using autolayout?

坚强是说给别人听的谎言 提交于 2019-12-02 07:03:50
Attaching the view i am planning to design. I would like to position the Buttons with respect to Superview and their Width and Height must increase proportionally to the Screen Size rather than remaining fixed. Attaching the screen preview: This is an example just for one row of your buttons, so they can be reused for other UI elements. Put these constraints onto your buttons: LEFT BUTTON: left leading constraint top leading constraint height constraint RIGHT BUTTON right trailing constraint top leading constraint height constraint And constraints related to both buttons: (you need to select

How to change font size for iPhone 4 and IPhone 5 in auto-layout?

自闭症网瘾萝莉.ら 提交于 2019-12-01 12:44:00
I am trying to change font size of uilabel for iphone 4 and iphone 5 using autolayout and size classes. IB is giving option only for ipad and greater phones like iphone 6 and 6P . If i change font for wR and hR then it changes fonts size for iphone 4 , 5 and 6 which is wrong in my case . Please help me in this regard. Unfortunately , Apple Provides minimum consideration for all iPhone's(4,5,6,6p version) Portrait Mode Compact Width - Compact Height or Compact Width - Regular Height . So You can't specify Font Size separately for different iPhones in Portrait Mode from Storyboard. 来源: https:/

How can I create UIStackView with variable spacing between views?

笑着哭i 提交于 2019-11-30 10:53:50
问题 I have a simple horizontal UIStackView with several UIViews stacked inside. My goal is to create variable spacing between views. I am well aware that I can create constant space between the subviews using "spacing" property. However my goal is to create variable space. Please note, if at all possible, I would like to avoid using invisible views that act as spacers. The best I came up with was to wrap my UIViews in a separate UIStackView , and use layoutMarginsRelativeArrangement = YES to

How can I create UIStackView with variable spacing between views?

隐身守侯 提交于 2019-11-29 23:31:07
I have a simple horizontal UIStackView with several UIViews stacked inside. My goal is to create variable spacing between views. I am well aware that I can create constant space between the subviews using "spacing" property. However my goal is to create variable space. Please note, if at all possible, I would like to avoid using invisible views that act as spacers. The best I came up with was to wrap my UIViews in a separate UIStackView , and use layoutMarginsRelativeArrangement = YES to respect layout margins of my inner stack. I was hoping I could do something similar with any UIView without

iOS: autolayout for multiple button

梦想的初衷 提交于 2019-11-29 12:45:45
In my app I have a view for 4 inch screens in this way: And then I want to reduce the size of my buttons when the app is running on an iPhone with a 3.5 inch screen, so I set my layout in this way: but finally I obtain a view in this way In this way the size of my button are ok but they are not aligned, so in this situation, what's the way to have aligned buttons? thanks Hi as per your question i've created demo similar to the layout for which you need the controls need to set. I've added images for single control and made video this using multiple controls to set the layout which you retrying

Swift dynamic table cell height [duplicate]

99封情书 提交于 2019-11-27 21:52:42
This question already has an answer here: Using Auto Layout in UITableView for dynamic cell layouts & variable row heights 26 answers I have tableview with prototype cell, in the cell I have imageview and some text under. The text label is one laine in the prototype cell, but sometimes it is more than one line, I'm loading the data to the table view after server call. The label in storyboard Lines are set to 0 and Line Break to Word Wrap. I also tried http://candycode.io/automatically-resizing-uitableviewcells-with-dynamic-text-height-using-auto-layout/ but no effect. If I use Using Auto

UITableView dynamic cell heights only correct after some scrolling

橙三吉。 提交于 2019-11-27 10:25:13
I have a UITableView with a custom UITableViewCell defined in a storyboard using auto layout. The cell has several multiline UILabels . The UITableView appears to properly calculate cell heights, but for the first few cells that height isn't properly divided between the labels. After scrolling a bit, everything works as expected (even the cells that were initially incorrect). - (void)viewDidLoad { [super viewDidLoad] // ... self.tableView.rowHeight = UITableViewAutomaticDimension; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {